home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 24 / AACD 24.iso / AACD / Sound / LAME / WarpOS / src / ltmain.sh < prev    next >
Encoding:
Text File  |  2000-10-22  |  110.8 KB  |  4,120 lines

  1. # ltmain.sh - Provide generalized library-building support services.
  2. # NOTE: Changing this file will not affect anything until you rerun ltconfig.
  3. #
  4. # Copyright (C) 1996-1999 Free Software Foundation, Inc.
  5. # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
  6. #
  7. # This program is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation; either version 2 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful, but
  13. # WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15. # General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with this program; if not, write to the Free Software
  19. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  20. #
  21. # As a special exception to the GNU General Public License, if you
  22. # distribute this file as part of a program that contains a
  23. # configuration script generated by Autoconf, you may include it under
  24. # the same distribution terms that you use for the rest of that program.
  25.  
  26. # Check that we have a working $echo.
  27. if test "X$1" = X--no-reexec; then
  28.   # Discard the --no-reexec flag, and continue.
  29.   shift
  30. elif test "X$1" = X--fallback-echo; then
  31.   # Avoid inline document here, it may be left over
  32.   :
  33. elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
  34.   # Yippee, $echo works!
  35.   :
  36. else
  37.   # Restart under the correct shell, and then maybe $echo will work.
  38.   exec $SHELL "$0" --no-reexec ${1+"$@"}
  39. fi
  40.  
  41. if test "X$1" = X--fallback-echo; then
  42.   # used as fallback echo
  43.   shift
  44.   cat <<EOF
  45. $*
  46. EOF
  47.   exit 0
  48. fi
  49.  
  50. # The name of this program.
  51. progname=`$echo "$0" | sed 's%^.*/%%'`
  52. modename="$progname"
  53.  
  54. # Constants.
  55. PROGRAM=ltmain.sh
  56. PACKAGE=libtool
  57. VERSION=1.3.4-freebsd-ports
  58. TIMESTAMP=" (1.385.2.196 1999/12/07 21:47:57)"
  59.  
  60. default_mode=
  61. help="Try \`$progname --help' for more information."
  62. magic="%%%MAGIC variable%%%"
  63. mkdir="mkdir"
  64. mv="mv -f"
  65. rm="rm -f"
  66.  
  67. # Sed substitution that helps us do robust quoting.  It backslashifies
  68. # metacharacters that are still active within double-quoted strings.
  69. Xsed='sed -e 1s/^X//'
  70. sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
  71. SP2NL='tr \040 \012'
  72. NL2SP='tr \015\012 \040\040'
  73.  
  74. # NLS nuisances.
  75. # Only set LANG and LC_ALL to C if already set.
  76. # These must not be set unconditionally because not all systems understand
  77. # e.g. LANG=C (notably SCO).
  78. # We save the old values to restore during execute mode.
  79. if test "${LC_ALL+set}" = set; then
  80.   save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
  81. fi
  82. if test "${LANG+set}" = set; then
  83.   save_LANG="$LANG"; LANG=C; export LANG
  84. fi
  85.  
  86. if test "$LTCONFIG_VERSION" != "$VERSION"; then
  87.   echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
  88.   echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
  89.   exit 1
  90. fi
  91.  
  92. if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
  93.   echo "$modename: not configured to build any kind of library" 1>&2
  94.   echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
  95.   exit 1
  96. fi
  97.  
  98. # Global variables.
  99. mode=$default_mode
  100. nonopt=
  101. prev=
  102. prevopt=
  103. run=
  104. show="$echo"
  105. show_help=
  106. execute_dlfiles=
  107. lo2o="s/\\.lo\$/.${objext}/"
  108. o2lo="s/\\.${objext}\$/.lo/"
  109.  
  110. # Parse our command line options once, thoroughly.
  111. while test $# -gt 0
  112. do
  113.   arg="$1"
  114.   shift
  115.  
  116.   case "$arg" in
  117.   -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
  118.   *) optarg= ;;
  119.   esac
  120.  
  121.   # If the previous option needs an argument, assign it.
  122.   if test -n "$prev"; then
  123.     case "$prev" in
  124.     execute_dlfiles)
  125.       eval "$prev=\"\$$prev \$arg\""
  126.       ;;
  127.     *)
  128.       eval "$prev=\$arg"
  129.       ;;
  130.     esac
  131.  
  132.     prev=
  133.     prevopt=
  134.     continue
  135.   fi
  136.  
  137.   # Have we seen a non-optional argument yet?
  138.   case "$arg" in
  139.   --help)
  140.     show_help=yes
  141.     ;;
  142.  
  143.   --version)
  144.     echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
  145.     exit 0
  146.     ;;
  147.  
  148.   --config)
  149.     sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0
  150.     exit 0
  151.     ;;
  152.  
  153.   --debug)
  154.     echo "$progname: enabling shell trace mode"
  155.     set -x
  156.     ;;
  157.  
  158.   --dry-run | -n)
  159.     run=:
  160.     ;;
  161.  
  162.   --features)
  163.     echo "host: $host"
  164.     if test "$build_libtool_libs" = yes; then
  165.       echo "enable shared libraries"
  166.     else
  167.       echo "disable shared libraries"
  168.     fi
  169.     if test "$build_old_libs" = yes; then
  170.       echo "enable static libraries"
  171.     else
  172.       echo "disable static libraries"
  173.     fi
  174.     exit 0
  175.     ;;
  176.  
  177.   --finish) mode="finish" ;;
  178.  
  179.   --mode) prevopt="--mode" prev=mode ;;
  180.   --mode=*) mode="$optarg" ;;
  181.  
  182.   --quiet | --silent)
  183.     show=:
  184.     ;;
  185.  
  186.   -dlopen)
  187.     prevopt="-dlopen"
  188.     prev=execute_dlfiles
  189.     ;;
  190.  
  191.   -*)
  192.     $echo "$modename: unrecognized option \`$arg'" 1>&2
  193.     $echo "$help" 1>&2
  194.     exit 1
  195.     ;;
  196.  
  197.   *)
  198.     nonopt="$arg"
  199.     break
  200.     ;;
  201.   esac
  202. done
  203.  
  204. if test -n "$prevopt"; then
  205.   $echo "$modename: option \`$prevopt' requires an argument" 1>&2
  206.   $echo "$help" 1>&2
  207.   exit 1
  208. fi
  209.  
  210. if test -z "$show_help"; then
  211.  
  212.   # Infer the operation mode.
  213.   if test -z "$mode"; then
  214.     case "$nonopt" in
  215.     *cc | *++ | gcc* | *-gcc*)
  216.       mode=link
  217.       for arg
  218.       do
  219.     case "$arg" in
  220.     -c)
  221.        mode=compile
  222.        break
  223.        ;;
  224.     esac
  225.       done
  226.       ;;
  227.     *db | *dbx | *strace | *truss)
  228.       mode=execute
  229.       ;;
  230.     *install*|cp|mv)
  231.       mode=install
  232.       ;;
  233.     *rm)
  234.       mode=uninstall
  235.       ;;
  236.     *)
  237.       # If we have no mode, but dlfiles were specified, then do execute mode.
  238.       test -n "$execute_dlfiles" && mode=execute
  239.  
  240.       # Just use the default operation mode.
  241.       if test -z "$mode"; then
  242.     if test -n "$nonopt"; then
  243.       $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
  244.     else
  245.       $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
  246.     fi
  247.       fi
  248.       ;;
  249.     esac
  250.   fi
  251.  
  252.   # Only execute mode is allowed to have -dlopen flags.
  253.   if test -n "$execute_dlfiles" && test "$mode" != execute; then
  254.     $echo "$modename: unrecognized option \`-dlopen'" 1>&2
  255.     $echo "$help" 1>&2
  256.     exit 1
  257.   fi
  258.  
  259.   # Change the help message to a mode-specific one.
  260.   generic_help="$help"
  261.   help="Try \`$modename --help --mode=$mode' for more information."
  262.  
  263.   # These modes are in order of execution frequency so that they run quickly.
  264.   case "$mode" in
  265.   # libtool compile mode
  266.   compile)
  267.     modename="$modename: compile"
  268.     # Get the compilation command and the source file.
  269.     base_compile=
  270.     lastarg=
  271.     srcfile="$nonopt"
  272.     suppress_output=
  273.  
  274.     user_target=no
  275.     for arg
  276.     do
  277.       # Accept any command-line options.
  278.       case "$arg" in
  279.       -o)
  280.     if test "$user_target" != "no"; then
  281.       $echo "$modename: you cannot specify \`-o' more than once" 1>&2
  282.       exit 1
  283.     fi
  284.     user_target=next
  285.     ;;
  286.  
  287.       -static)
  288.     build_old_libs=yes
  289.     continue
  290.     ;;
  291.       esac
  292.  
  293.       case "$user_target" in
  294.       next)
  295.     # The next one is the -o target name
  296.     user_target=yes
  297.     continue
  298.     ;;
  299.       yes)
  300.     # We got the output file
  301.     user_target=set
  302.     libobj="$arg"
  303.     continue
  304.     ;;
  305.       esac
  306.  
  307.       # Accept the current argument as the source file.
  308.       lastarg="$srcfile"
  309.       srcfile="$arg"
  310.  
  311.       # Aesthetically quote the previous argument.
  312.  
  313.       # Backslashify any backslashes, double quotes, and dollar signs.
  314.       # These are the only characters that are still specially
  315.       # interpreted inside of double-quoted scrings.
  316.       lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
  317.  
  318.       # Double-quote args containing other shell metacharacters.
  319.       # Many Bourne shells cannot handle close brackets correctly in scan
  320.       # sets, so we specify it separately.
  321.       case "$lastarg" in
  322.       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*)
  323.     lastarg="\"$lastarg\""
  324.     ;;
  325.       esac
  326.  
  327.       # Add the previous argument to base_compile.
  328.       if test -z "$base_compile"; then
  329.     base_compile="$lastarg"
  330.       else
  331.     base_compile="$base_compile $lastarg"
  332.       fi
  333.     done
  334.  
  335.     case "$user_target" in
  336.     set)
  337.       ;;
  338.     no)
  339.       # Get the name of the library object.
  340.       libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
  341.       ;;
  342.     *)
  343.       $echo "$modename: you must specify a target with \`-o'" 1>&2
  344.       exit 1
  345.       ;;
  346.     esac
  347.  
  348.     # Recognize several different file suffixes.
  349.     # If the user specifies -o file.o, it is replaced with file.lo
  350.     xform='[cCFSfmso]'
  351.     case "$libobj" in
  352.     *.ada) xform=ada ;;
  353.     *.adb) xform=adb ;;
  354.     *.ads) xform=ads ;;
  355.     *.asm) xform=asm ;;
  356.     *.c++) xform=c++ ;;
  357.     *.cc) xform=cc ;;
  358.     *.cpp) xform=cpp ;;
  359.     *.cxx) xform=cxx ;;
  360.     *.f90) xform=f90 ;;
  361.     *.for) xform=for ;;
  362.     esac
  363.  
  364.     libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
  365.  
  366.     case "$libobj" in
  367.     *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
  368.     *)
  369.       $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
  370.       exit 1
  371.       ;;
  372.     esac
  373.  
  374.     if test -z "$base_compile"; then
  375.       $echo "$modename: you must specify a compilation command" 1>&2
  376.       $echo "$help" 1>&2
  377.       exit 1
  378.     fi
  379.  
  380.     # Delete any leftover library objects.
  381.     if test "$build_old_libs" = yes; then
  382.       removelist="$obj $libobj"
  383.     else
  384.       removelist="$libobj"
  385.     fi
  386.  
  387.     $run $rm $removelist
  388.     trap "$run $rm $removelist; exit 1" 1 2 15
  389.  
  390.     # Calculate the filename of the output object if compiler does
  391.     # not support -o with -c
  392.     if test "$compiler_c_o" = no; then
  393.       output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.${objext}
  394.       lockfile="$output_obj.lock"
  395.       removelist="$removelist $output_obj $lockfile"
  396.       trap "$run $rm $removelist; exit 1" 1 2 15
  397.     else
  398.       need_locks=no
  399.       lockfile=
  400.     fi
  401.  
  402.     # Lock this critical section if it is needed
  403.     # We use this script file to make the link, it avoids creating a new file
  404.     if test "$need_locks" = yes; then
  405.       until ln "$0" "$lockfile" 2>/dev/null; do
  406.     $show "Waiting for $lockfile to be removed"
  407.     sleep 2
  408.       done
  409.     elif test "$need_locks" = warn; then
  410.       if test -f "$lockfile"; then
  411.     echo "\
  412. *** ERROR, $lockfile exists and contains:
  413. `cat $lockfile 2>/dev/null`
  414.  
  415. This indicates that another process is trying to use the same
  416. temporary object file, and libtool could not work around it because
  417. your compiler does not support \`-c' and \`-o' together.  If you
  418. repeat this compilation, it may succeed, by chance, but you had better
  419. avoid parallel builds (make -j) in this platform, or get a better
  420. compiler."
  421.  
  422.     $run $rm $removelist
  423.     exit 1
  424.       fi
  425.       echo $srcfile > "$lockfile"
  426.     fi
  427.  
  428.     if test -n "$fix_srcfile_path"; then
  429.       eval srcfile=\"$fix_srcfile_path\"
  430.     fi
  431.  
  432.     # Only build a PIC object if we are building libtool libraries.
  433.     if test "$build_libtool_libs" = yes; then
  434.       # Without this assignment, base_compile gets emptied.
  435.       fbsd_hideous_sh_bug=$base_compile
  436.  
  437.       # All platforms use -DPIC, to notify preprocessed assembler code.
  438.       command="$base_compile $srcfile $pic_flag -DPIC"
  439.       if test "$build_old_libs" = yes; then
  440.     lo_libobj="$libobj"
  441.     dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
  442.     if test "X$dir" = "X$libobj"; then
  443.       dir="$objdir"
  444.     else
  445.       dir="$dir/$objdir"
  446.     fi
  447.     libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
  448.  
  449.     if test -d "$dir"; then
  450.       $show "$rm $libobj"
  451.       $run $rm $libobj
  452.     else
  453.       $show "$mkdir $dir"
  454.       $run $mkdir $dir
  455.       status=$?
  456.       if test $status -ne 0 && test ! -d $dir; then
  457.         exit $status
  458.       fi
  459.     fi
  460.       fi
  461.       if test "$compiler_o_lo" = yes; then
  462.     output_obj="$libobj"
  463.     command="$command -o $output_obj"
  464.       elif test "$compiler_c_o" = yes; then
  465.     output_obj="$obj"
  466.     command="$command -o $output_obj"
  467.       fi
  468.  
  469.       $run $rm "$output_obj"
  470.       $show "$command"
  471.       if $run eval "$command"; then :
  472.       else
  473.     test -n "$output_obj" && $run $rm $removelist
  474.     exit 1
  475.       fi
  476.  
  477.       if test "$need_locks" = warn &&
  478.      test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
  479.     echo "\
  480. *** ERROR, $lockfile contains:
  481. `cat $lockfile 2>/dev/null`
  482.  
  483. but it should contain:
  484. $srcfile
  485.  
  486. This indicates that another process is trying to use the same
  487. temporary object file, and libtool could not work around it because
  488. your compiler does not support \`-c' and \`-o' together.  If you
  489. repeat this compilation, it may succeed, by chance, but you had better
  490. avoid parallel builds (make -j) in this platform, or get a better
  491. compiler."
  492.  
  493.     $run $rm $removelist
  494.     exit 1
  495.       fi
  496.  
  497.       # Just move the object if needed, then go on to compile the next one
  498.       if test x"$output_obj" != x"$libobj"; then
  499.     $show "$mv $output_obj $libobj"
  500.     if $run $mv $output_obj $libobj; then :
  501.     else
  502.       error=$?
  503.       $run $rm $removelist
  504.       exit $error
  505.     fi
  506.       fi
  507.  
  508.       # If we have no pic_flag, then copy the object into place and finish.
  509.       if test -z "$pic_flag" && test "$build_old_libs" = yes; then
  510.     # Rename the .lo from within objdir to obj
  511.     if test -f $obj; then
  512.       $show $rm $obj
  513.       $run $rm $obj
  514.     fi
  515.  
  516.     $show "$mv $libobj $obj"
  517.     if $run $mv $libobj $obj; then :
  518.     else
  519.       error=$?
  520.       $run $rm $removelist
  521.       exit $error
  522.     fi
  523.  
  524.     xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
  525.     if test "X$xdir" = "X$obj"; then
  526.       xdir="."
  527.     else
  528.       xdir="$xdir"
  529.     fi
  530.     baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
  531.     libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
  532.     # Now arrange that obj and lo_libobj become the same file
  533.     $show "(cd $xdir && $LN_S $baseobj $libobj)"
  534.     if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
  535.       exit 0
  536.     else
  537.       error=$?
  538.       $run $rm $removelist
  539.       exit $error
  540.     fi
  541.       fi
  542.  
  543.       # Allow error messages only from the first compilation.
  544.       suppress_output=' >/dev/null 2>&1'
  545.     fi
  546.  
  547.     # Only build a position-dependent object if we build old libraries.
  548.     if test "$build_old_libs" = yes; then
  549.       command="$base_compile $srcfile"
  550.       if test "$compiler_c_o" = yes; then
  551.     command="$command -o $obj"
  552.     output_obj="$obj"
  553.       fi
  554.  
  555.       # Suppress compiler output if we already did a PIC compilation.
  556.       command="$command$suppress_output"
  557.       $run $rm "$output_obj"
  558.       $show "$command"
  559.       if $run eval "$command"; then :
  560.       else
  561.     $run $rm $removelist
  562.     exit 1
  563.       fi
  564.  
  565.       if test "$need_locks" = warn &&
  566.      test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
  567.     echo "\
  568. *** ERROR, $lockfile contains:
  569. `cat $lockfile 2>/dev/null`
  570.  
  571. but it should contain:
  572. $srcfile
  573.  
  574. This indicates that another process is trying to use the same
  575. temporary object file, and libtool could not work around it because
  576. your compiler does not support \`-c' and \`-o' together.  If you
  577. repeat this compilation, it may succeed, by chance, but you had better
  578. avoid parallel builds (make -j) in this platform, or get a better
  579. compiler."
  580.  
  581.     $run $rm $removelist
  582.     exit 1
  583.       fi
  584.  
  585.       # Just move the object if needed
  586.       if test x"$output_obj" != x"$obj"; then
  587.     $show "$mv $output_obj $obj"
  588.     if $run $mv $output_obj $obj; then :
  589.     else
  590.       error=$?
  591.       $run $rm $removelist
  592.       exit $error
  593.     fi
  594.       fi
  595.  
  596.       # Create an invalid libtool object if no PIC, so that we do not
  597.       # accidentally link it into a program.
  598.       if test "$build_libtool_libs" != yes; then
  599.     $show "echo timestamp > $libobj"
  600.     $run eval "echo timestamp > \$libobj" || exit $?
  601.       else
  602.     # Move the .lo from within objdir
  603.     $show "$mv $libobj $lo_libobj"
  604.     if $run $mv $libobj $lo_libobj; then :
  605.     else
  606.       error=$?
  607.       $run $rm $removelist
  608.       exit $error
  609.     fi
  610.       fi
  611.     fi
  612.  
  613.     # Unlock the critical section if it was locked
  614.     if test "$need_locks" != no; then
  615.       $rm "$lockfile"
  616.     fi
  617.  
  618.     exit 0
  619.     ;;
  620.  
  621.   # libtool link mode
  622.   link)
  623.     modename="$modename: link"
  624.     case "$host" in
  625.     *-*-cygwin* | *-*-mingw* | *-*-os2*)
  626.       # It is impossible to link a dll without this setting, and
  627.       # we shouldn't force the makefile maintainer to figure out
  628.       # which system we are compiling for in order to pass an extra
  629.       # flag for every libtool invokation.
  630.       # allow_undefined=no
  631.  
  632.       # FIXME: Unfortunately, there are problems with the above when trying
  633.       # to make a dll which has undefined symbols, in which case not
  634.       # even a static library is built.  For now, we need to specify
  635.       # -no-undefined on the libtool link line when we can be certain
  636.       # that all symbols are satisfied, otherwise we get a static library.
  637.       allow_undefined=yes
  638.  
  639.       # This is a source program that is used to create dlls on Windows
  640.       # Don't remove nor modify the starting and closing comments
  641. # /* ltdll.c starts here */
  642. # #define WIN32_LEAN_AND_MEAN
  643. # #include <windows.h>
  644. # #undef WIN32_LEAN_AND_MEAN
  645. # #include <stdio.h>
  646. #
  647. # #ifndef __CYGWIN__
  648. # #  ifdef __CYGWIN32__
  649. # #    define __CYGWIN__ __CYGWIN32__
  650. # #  endif
  651. # #endif
  652. #
  653. # #ifdef __cplusplus
  654. # extern "C" {
  655. # #endif
  656. # BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
  657. # #ifdef __cplusplus
  658. # }
  659. # #endif
  660. #
  661. # #ifdef __CYGWIN__
  662. # #include <cygwin/cygwin_dll.h>
  663. # DECLARE_CYGWIN_DLL( DllMain );
  664. # #endif
  665. # HINSTANCE __hDllInstance_base;
  666. #
  667. # BOOL APIENTRY
  668. # DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
  669. # {
  670. #   __hDllInstance_base = hInst;
  671. #   return TRUE;
  672. # }
  673. # /* ltdll.c ends here */
  674.       # This is a source program that is used to create import libraries
  675.       # on Windows for dlls which lack them. Don't remove nor modify the
  676.       # starting and closing comments
  677. # /* impgen.c starts here */
  678. # /*   Copyright (C) 1999 Free Software Foundation, Inc.
  679. #  This file is part of GNU libtool.
  680. #  This program is free software; you can redistribute it and/or modify
  681. #  it under the terms of the GNU General Public License as published by
  682. #  the Free Software Foundation; either version 2 of the License, or
  683. #  (at your option) any later version.
  684. #  This program is distributed in the hope that it will be useful,
  685. #  but WITHOUT ANY WARRANTY; without even the implied warranty of
  686. #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  687. #  GNU General Public License for more details.
  688. #  You should have received a copy of the GNU General Public License
  689. #  along with this program; if not, write to the Free Software
  690. #  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  691. #  */
  692. #  #include <stdio.h>        /* for printf() */
  693. #  #include <unistd.h>        /* for open(), lseek(), read() */
  694. #  #include <fcntl.h>        /* for O_RDONLY, O_BINARY */
  695. #  #include <string.h>        /* for strdup() */
  696. #  static unsigned int
  697. #  pe_get16 (fd, offset)
  698. #       int fd;
  699. #       int offset;
  700. #  {
  701. #    unsigned char b[2];
  702. #    lseek (fd, offset, SEEK_SET);
  703. #    read (fd, b, 2);
  704. #    return b[0] + (b[1]<<8);
  705. #  }
  706. #  static unsigned int
  707. #  pe_get32 (fd, offset)
  708. #      int fd;
  709. #      int offset;
  710. #  {
  711. #    unsigned char b[4];
  712. #    lseek (fd, offset, SEEK_SET);
  713. #    read (fd, b, 4);
  714. #    return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
  715. #  }
  716. #  static unsigned int
  717. #  pe_as32 (ptr)
  718. #       void *ptr;
  719. #  {
  720. #    unsigned char *b = ptr;
  721. #    return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
  722. #  }
  723. #  int
  724. #  main (argc, argv)
  725. #      int argc;
  726. #      char *argv[];
  727. #  {
  728. #      int dll;
  729. #      unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
  730. #      unsigned long export_rva, export_size, nsections, secptr, expptr;
  731. #      unsigned long name_rvas, nexp;
  732. #      unsigned char *expdata, *erva;
  733. #      char *filename, *dll_name;
  734. #      filename = argv[1];
  735. #      dll = open(filename, O_RDONLY|O_BINARY);
  736. #      if (!dll)
  737. #      return 1;
  738. #      dll_name = filename;
  739. #    
  740. #      for (i=0; filename[i]; i++)
  741. #      if (filename[i] == '/' || filename[i] == '\\'  || filename[i] == ':')
  742. #          dll_name = filename + i +1;
  743. #      pe_header_offset = pe_get32 (dll, 0x3c);
  744. #      opthdr_ofs = pe_header_offset + 4 + 20;
  745. #      num_entries = pe_get32 (dll, opthdr_ofs + 92);
  746. #      if (num_entries < 1) /* no exports */
  747. #      return 1;
  748. #      export_rva = pe_get32 (dll, opthdr_ofs + 96);
  749. #      export_size = pe_get32 (dll, opthdr_ofs + 100);
  750. #      nsections = pe_get16 (dll, pe_header_offset + 4 +2);
  751. #      secptr = (pe_header_offset + 4 + 20 +
  752. #            pe_get16 (dll, pe_header_offset + 4 + 16));
  753. #      expptr = 0;
  754. #      for (i = 0; i < nsections; i++)
  755. #      {
  756. #      char sname[8];
  757. #      unsigned long secptr1 = secptr + 40 * i;
  758. #      unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
  759. #      unsigned long vsize = pe_get32 (dll, secptr1 + 16);
  760. #      unsigned long fptr = pe_get32 (dll, secptr1 + 20);
  761. #      lseek(dll, secptr1, SEEK_SET);
  762. #      read(dll, sname, 8);
  763. #      if (vaddr <= export_rva && vaddr+vsize > export_rva)
  764. #      {
  765. #          expptr = fptr + (export_rva - vaddr);
  766. #          if (export_rva + export_size > vaddr + vsize)
  767. #          export_size = vsize - (export_rva - vaddr);
  768. #          break;
  769. #      }
  770. #      }
  771. #      expdata = (unsigned char*)malloc(export_size);
  772. #      lseek (dll, expptr, SEEK_SET);
  773. #      read (dll, expdata, export_size);
  774. #      erva = expdata - export_rva;
  775. #      nexp = pe_as32 (expdata+24);
  776. #      name_rvas = pe_as32 (expdata+32);
  777. #      printf ("EXPORTS\n");
  778. #      for (i = 0; i<nexp; i++)
  779. #      {
  780. #      unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
  781. #      printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);
  782. #      }
  783. #      return 0;
  784. #  }
  785. # /* impgen.c ends here */
  786.       ;;
  787.     *)
  788.       allow_undefined=yes
  789.       ;;
  790.     esac
  791.     compile_command="$nonopt"
  792.     finalize_command="$nonopt"
  793.  
  794.     compile_rpath=
  795.     finalize_rpath=
  796.     compile_shlibpath=
  797.     finalize_shlibpath=
  798.     convenience=
  799.     old_convenience=
  800.     deplibs=
  801.     linkopts=
  802.  
  803.     if test -n "$shlibpath_var"; then
  804.       # get the directories listed in $shlibpath_var
  805.       eval lib_search_path=\`\$echo \"X \${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
  806.     else
  807.       lib_search_path=
  808.     fi
  809.     # now prepend the system-specific ones
  810.     eval lib_search_path=\"$sys_lib_search_path_spec\$lib_search_path\"
  811.     eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
  812.     
  813.     avoid_version=no
  814.     dlfiles=
  815.     dlprefiles=
  816.     dlself=no
  817.     export_dynamic=no
  818.     export_symbols=
  819.     export_symbols_regex=
  820.     generated=
  821.     libobjs=
  822.     link_against_libtool_libs=
  823.     ltlibs=
  824.     module=no
  825.     objs=
  826.     prefer_static_libs=no
  827.     preload=no
  828.     prev=
  829.     prevarg=
  830.     release=
  831.     rpath=
  832.     xrpath=
  833.     perm_rpath=
  834.     temp_rpath=
  835.     thread_safe=no
  836.     vinfo=
  837.  
  838.     # We need to know -static, to get the right output filenames.
  839.     for arg
  840.     do
  841.       case "$arg" in
  842.       -all-static | -static)
  843.     if test "X$arg" = "X-all-static"; then
  844.       if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
  845.         $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
  846.       fi
  847.       if test -n "$link_static_flag"; then
  848.         dlopen_self=$dlopen_self_static
  849.       fi
  850.     else
  851.       if test -z "$pic_flag" && test -n "$link_static_flag"; then
  852.         dlopen_self=$dlopen_self_static
  853.       fi
  854.     fi
  855.     build_libtool_libs=no
  856.     build_old_libs=yes
  857.     prefer_static_libs=yes
  858.     break
  859.     ;;
  860.       esac
  861.     done
  862.  
  863.     # See if our shared archives depend on static archives.
  864.     test -n "$old_archive_from_new_cmds" && build_old_libs=yes
  865.  
  866.     # Go through the arguments, transforming them on the way.
  867.     while test $# -gt 0; do
  868.       arg="$1"
  869.       shift
  870.  
  871.       # If the previous option needs an argument, assign it.
  872.       if test -n "$prev"; then
  873.     case "$prev" in
  874.     output)
  875.       compile_command="$compile_command @OUTPUT@"
  876.       finalize_command="$finalize_command @OUTPUT@"
  877.       ;;
  878.     esac
  879.  
  880.     case "$prev" in
  881.     dlfiles|dlprefiles)
  882.       if test "$preload" = no; then
  883.         # Add the symbol object into the linking commands.
  884.         compile_command="$compile_command @SYMFILE@"
  885.         finalize_command="$finalize_command @SYMFILE@"
  886.         preload=yes
  887.       fi
  888.       case "$arg" in
  889.       *.la | *.lo) ;;  # We handle these cases below.
  890.       force)
  891.         if test "$dlself" = no; then
  892.           dlself=needless
  893.           export_dynamic=yes
  894.         fi
  895.         prev=
  896.         continue
  897.         ;;
  898.       self)
  899.         if test "$prev" = dlprefiles; then
  900.           dlself=yes
  901.         elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
  902.           dlself=yes
  903.         else
  904.           dlself=needless
  905.           export_dynamic=yes
  906.         fi
  907.         prev=
  908.         continue
  909.         ;;
  910.       *)
  911.         if test "$prev" = dlfiles; then
  912.           dlfiles="$dlfiles $arg"
  913.         else
  914.           dlprefiles="$dlprefiles $arg"
  915.         fi
  916.         prev=
  917.         ;;
  918.       esac
  919.       ;;
  920.     expsyms)
  921.       export_symbols="$arg"
  922.       if test ! -f "$arg"; then
  923.         $echo "$modename: symbol file \`$arg' does not exist"
  924.         exit 1
  925.       fi
  926.       prev=
  927.       continue
  928.       ;;
  929.     expsyms_regex)
  930.       export_symbols_regex="$arg"
  931.       prev=
  932.       continue
  933.       ;;
  934.     release)
  935.       if test "$release_suffix" = all; then
  936.         release="$arg"
  937.       elif test "$release_suffix" = yes; then
  938.         release="-$arg"
  939.       fi
  940.       prev=
  941.       continue
  942.       ;;
  943.     rpath | xrpath)
  944.       # We need an absolute path.
  945.       case "$arg" in
  946.       [\\/]* | [A-Za-z]:[\\/]*) ;;
  947.       *)
  948.         $echo "$modename: only absolute run-paths are allowed" 1>&2
  949.         exit 1
  950.         ;;
  951.       esac
  952.       if test "$prev" = rpath; then
  953.         case "$rpath " in
  954.         *" $arg "*) ;;
  955.         *) rpath="$rpath $arg" ;;
  956.         esac
  957.       else
  958.         case "$xrpath " in
  959.         *" $arg "*) ;;
  960.         *) xrpath="$xrpath $arg" ;;
  961.         esac
  962.       fi
  963.       prev=
  964.       continue
  965.       ;;
  966.     *)
  967.       eval "$prev=\"\$arg\""
  968.       prev=
  969.       continue
  970.       ;;
  971.     esac
  972.       fi
  973.  
  974.       prevarg="$arg"
  975.  
  976.       case "$arg" in
  977.       -all-static)
  978.     if test -n "$link_static_flag"; then
  979.       compile_command="$compile_command $link_static_flag"
  980.       finalize_command="$finalize_command $link_static_flag"
  981.     fi
  982.     continue
  983.     ;;
  984.  
  985.       -allow-undefined)
  986.     # FIXME: remove this flag sometime in the future.
  987.     $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
  988.     continue
  989.     ;;
  990.  
  991.       -avoid-version)
  992.     build_old_libs=no
  993.     avoid_version=yes
  994.     continue
  995.     ;;
  996.  
  997.       -dlopen)
  998.     prev=dlfiles
  999.     continue
  1000.     ;;
  1001.  
  1002.       -dlpreopen)
  1003.     prev=dlprefiles
  1004.     continue
  1005.     ;;
  1006.  
  1007.       -export-dynamic)
  1008.     export_dynamic=yes
  1009.     continue
  1010.     ;;
  1011.  
  1012.       -export-symbols | -export-symbols-regex)
  1013.     if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  1014.       $echo "$modename: not more than one -exported-symbols argument allowed"
  1015.       exit 1
  1016.     fi
  1017.     if test "X$arg" = "X-export-symbols"; then
  1018.       prev=expsyms
  1019.     else
  1020.       prev=expsyms_regex
  1021.     fi
  1022.     continue
  1023.     ;;
  1024.  
  1025.       -L*)
  1026.     dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
  1027.     # We need an absolute path.
  1028.     case "$dir" in
  1029.     [\\/]* | [A-Za-z]:[\\/]*) ;;
  1030.     *)
  1031.       absdir=`cd "$dir" && pwd`
  1032.       if test -z "$absdir"; then
  1033.         $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
  1034.         $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
  1035.         absdir="$dir"
  1036.       fi
  1037.       dir="$absdir"
  1038.       ;;
  1039.     esac
  1040.     case " $deplibs " in
  1041.     *" $arg "*) ;;
  1042.     *) deplibs="$deplibs $arg";;
  1043.     esac
  1044.     case " $lib_search_path " in
  1045.     *" $dir "*) ;;
  1046.     *) lib_search_path="$lib_search_path $dir";;
  1047.     esac
  1048.     case "$host" in
  1049.     *-*-cygwin* | *-*-mingw* | *-*-os2*)
  1050.       dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
  1051.       case ":$dllsearchpath:" in
  1052.       ::) dllsearchpath="$dllsearchdir";;
  1053.       *":$dllsearchdir:"*) ;;
  1054.       *) dllsearchpath="$dllsearchpath:$dllsearchdir";;
  1055.       esac
  1056.       ;;
  1057.     esac
  1058.     ;;
  1059.  
  1060.       -l*)
  1061.     if test "$arg" = "-lc"; then
  1062.       case "$host" in
  1063.       *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
  1064.         # These systems don't actually have c library (as such)
  1065.         continue
  1066.         ;;
  1067.       esac
  1068.     elif test "$arg" = "-lm"; then
  1069.       case "$host" in
  1070.       *-*-cygwin* | *-*-beos*)
  1071.         # These systems don't actually have math library (as such)
  1072.         continue
  1073.         ;;
  1074.       esac
  1075.     fi
  1076.     deplibs="$deplibs $arg"
  1077.     ;;
  1078.  
  1079.       -?thread)
  1080.     deplibs="$deplibs $arg"
  1081.     ;;
  1082.  
  1083.       -module)
  1084.     module=yes
  1085.     continue
  1086.     ;;
  1087.  
  1088.       -no-undefined)
  1089.     allow_undefined=no
  1090.     continue
  1091.     ;;
  1092.  
  1093.       -o) prev=output ;;
  1094.  
  1095.       -release)
  1096.     prev=release
  1097.     continue
  1098.     ;;
  1099.  
  1100.       -rpath)
  1101.     prev=rpath
  1102.     continue
  1103.     ;;
  1104.  
  1105.       -R)
  1106.     prev=xrpath
  1107.     continue
  1108.     ;;
  1109.  
  1110.       -R*)
  1111.     dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
  1112.     # We need an absolute path.
  1113.     case "$dir" in
  1114.     [\\/]* | [A-Za-z]:[\\/]*) ;;
  1115.     *)
  1116.       $echo "$modename: only absolute run-paths are allowed" 1>&2
  1117.       exit 1
  1118.       ;;
  1119.     esac
  1120.     case "$xrpath " in
  1121.     *" $dir "*) ;;
  1122.     *) xrpath="$xrpath $dir" ;;
  1123.     esac
  1124.     continue
  1125.     ;;
  1126.  
  1127.       -static)
  1128.     # If we have no pic_flag, then this is the same as -all-static.
  1129.     if test -z "$pic_flag" && test -n "$link_static_flag"; then
  1130.       compile_command="$compile_command $link_static_flag"
  1131.       finalize_command="$finalize_command $link_static_flag"
  1132.     fi
  1133.     continue
  1134.     ;;
  1135.  
  1136.       -thread-safe)
  1137.     thread_safe=yes
  1138.     continue
  1139.     ;;
  1140.  
  1141.       -version-info)
  1142.     prev=vinfo
  1143.     continue
  1144.     ;;
  1145.  
  1146.       # Some other compiler flag.
  1147.       -* | +*)
  1148.     # Unknown arguments in both finalize_command and compile_command need
  1149.     # to be aesthetically quoted because they are evaled later.
  1150.     arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1151.     case "$arg" in
  1152.     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*)
  1153.       arg="\"$arg\""
  1154.       ;;
  1155.     esac
  1156.     ;;
  1157.  
  1158.       *.o | *.obj | *.a | *.lib)
  1159.     # A standard object.
  1160.     libobjs="$libobjs $arg"
  1161.     ;;
  1162.  
  1163.       *.lo)
  1164.     # A library object.
  1165.     if test "$prev" = dlfiles; then
  1166.       dlfiles="$dlfiles $arg"
  1167.       if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then
  1168.         prev=
  1169.         continue
  1170.       else
  1171.         # If libtool objects are unsupported, then we need to preload.
  1172.         prev=dlprefiles
  1173.       fi
  1174.     fi
  1175.  
  1176.     if test "$prev" = dlprefiles; then
  1177.       # Preload the old-style object.
  1178.       dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
  1179.       prev=
  1180.     fi
  1181.     libobjs="$libobjs $arg"
  1182.     ;;
  1183.  
  1184.       *.la)
  1185.     # A libtool-controlled library.
  1186.  
  1187.     dlname=
  1188.     libdir=
  1189.     library_names=
  1190.     old_library=
  1191.  
  1192.     # Check to see that this really is a libtool archive.
  1193.     if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  1194.     else
  1195.       $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
  1196.       exit 1
  1197.     fi
  1198.  
  1199.     # If the library was installed with an old release of libtool,
  1200.     # it will not redefine variable installed.
  1201.     installed=yes
  1202.  
  1203.     # Read the .la file
  1204.     # If there is no directory component, then add one.
  1205.     case "$arg" in
  1206.     */* | *\\*) . $arg ;;
  1207.     *) . ./$arg ;;
  1208.     esac
  1209.  
  1210.     # Get the name of the library we link against.
  1211.     linklib=
  1212.     for l in $old_library $library_names; do
  1213.       linklib="$l"
  1214.     done
  1215.  
  1216.     if test -z "$linklib"; then
  1217.       $echo "$modename: cannot find name of link library for \`$arg'" 1>&2
  1218.       exit 1
  1219.     fi
  1220.  
  1221.     # Find the relevant object directory and library name.
  1222.     name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
  1223.  
  1224.     if test "X$installed" = Xyes; then
  1225.       dir="$libdir"
  1226.     else
  1227.       dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1228.       if test "X$dir" = "X$arg"; then
  1229.         dir="$objdir"
  1230.       else
  1231.         dir="$dir/$objdir"
  1232.       fi
  1233.     fi
  1234.  
  1235.     if test -n "$dependency_libs"; then
  1236.       # Extract -R and -L from dependency_libs
  1237.       temp_deplibs=
  1238.       for deplib in $dependency_libs; do
  1239.         case "$deplib" in
  1240.         -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
  1241.          case " $rpath $xrpath " in
  1242.          *" $temp_xrpath "*) ;;
  1243.          *) xrpath="$xrpath $temp_xrpath";;
  1244.          esac;;
  1245.         -L*) case "$compile_command $temp_deplibs " in
  1246.          *" $deplib "*) ;;
  1247.          *) temp_deplibs="$temp_deplibs $deplib";;
  1248.          esac
  1249.          temp_dir=`$echo "X$deplib" | $Xsed -e 's/^-L//'`
  1250.          case " $lib_search_path " in
  1251.          *" $temp_dir "*) ;;
  1252.          *) lib_search_path="$lib_search_path $temp_dir";;
  1253.          esac
  1254.          ;;
  1255.         *) temp_deplibs="$temp_deplibs $deplib";;
  1256.         esac
  1257.       done
  1258.       dependency_libs="$temp_deplibs"
  1259.     fi
  1260.  
  1261.     if test -z "$libdir"; then
  1262.       # It is a libtool convenience library, so add in its objects.
  1263.       convenience="$convenience $dir/$old_library"
  1264.       old_convenience="$old_convenience $dir/$old_library"
  1265.       deplibs="$deplibs$dependency_libs"
  1266.       compile_command="$compile_command $dir/$old_library$dependency_libs"
  1267.       finalize_command="$finalize_command $dir/$old_library$dependency_libs"
  1268.       continue
  1269.     fi
  1270.  
  1271.     # This library was specified with -dlopen.
  1272.     if test "$prev" = dlfiles; then
  1273.       dlfiles="$dlfiles $arg"
  1274.       if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then
  1275.         # If there is no dlname, no dlopen support or we're linking statically,
  1276.         # we need to preload.
  1277.         prev=dlprefiles
  1278.       else
  1279.         # We should not create a dependency on this library, but we
  1280.         # may need any libraries it requires.
  1281.         compile_command="$compile_command$dependency_libs"
  1282.         finalize_command="$finalize_command$dependency_libs"
  1283.         prev=
  1284.         continue
  1285.       fi
  1286.     fi
  1287.  
  1288.     # The library was specified with -dlpreopen.
  1289.     if test "$prev" = dlprefiles; then
  1290.       # Prefer using a static library (so that no silly _DYNAMIC symbols
  1291.       # are required to link).
  1292.       if test -n "$old_library"; then
  1293.         dlprefiles="$dlprefiles $dir/$old_library"
  1294.       else
  1295.         dlprefiles="$dlprefiles $dir/$linklib"
  1296.       fi
  1297.       prev=
  1298.     fi
  1299.  
  1300.     if test -n "$library_names" &&
  1301.        { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
  1302.       link_against_libtool_libs="$link_against_libtool_libs $arg"
  1303.       if test -n "$shlibpath_var"; then
  1304.         # Make sure the rpath contains only unique directories.
  1305.         case "$temp_rpath " in
  1306.         *" $dir "*) ;;
  1307.         *) temp_rpath="$temp_rpath $dir" ;;
  1308.         esac
  1309.       fi
  1310.  
  1311.       # We need an absolute path.
  1312.       case "$dir" in
  1313.       [\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;;
  1314.       *)
  1315.         absdir=`cd "$dir" && pwd`
  1316.         if test -z "$absdir"; then
  1317.           $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
  1318.           $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
  1319.           absdir="$dir"
  1320.         fi
  1321.         ;;
  1322.       esac
  1323.       
  1324.       # This is the magic to use -rpath.
  1325.       # Skip directories that are in the system default run-time
  1326.       # search path, unless they have been requested with -R.
  1327.       case " $sys_lib_dlsearch_path " in
  1328.       *" $absdir "*) ;;
  1329.       *)
  1330.         case "$compile_rpath " in
  1331.         *" $absdir "*) ;;
  1332.         *) compile_rpath="$compile_rpath $absdir" 
  1333.         esac
  1334.         ;;
  1335.       esac
  1336.  
  1337.       case " $sys_lib_dlsearch_path " in
  1338.       *" $libdir "*) ;;
  1339.       *)
  1340.         case "$finalize_rpath " in
  1341.         *" $libdir "*) ;;
  1342.         *) finalize_rpath="$finalize_rpath $libdir"
  1343.         esac
  1344.         ;;
  1345.       esac
  1346.  
  1347.       lib_linked=yes
  1348.       case "$hardcode_action" in
  1349.       immediate | unsupported)
  1350.         if test "$hardcode_direct" = no; then
  1351.           compile_command="$compile_command $dir/$linklib"
  1352.           deplibs="$deplibs $dir/$linklib"
  1353.           case "$host" in
  1354.           *-*-cygwin* | *-*-mingw* | *-*-os2*)
  1355.         dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
  1356.         if test -n "$dllsearchpath"; then
  1357.           dllsearchpath="$dllsearchpath:$dllsearchdir"
  1358.         else
  1359.           dllsearchpath="$dllsearchdir"
  1360.         fi
  1361.         ;;
  1362.           esac
  1363.         elif test "$hardcode_minus_L" = no; then
  1364.           case "$host" in
  1365.           *-*-sunos*)
  1366.         compile_shlibpath="$compile_shlibpath$dir:"
  1367.         ;;
  1368.           esac
  1369.           case "$compile_command " in
  1370.           *" -L$dir "*) ;;
  1371.           *) compile_command="$compile_command -L$dir";;
  1372.           esac
  1373.           compile_command="$compile_command -l$name"
  1374.           deplibs="$deplibs -L$dir -l$name"
  1375.         elif test "$hardcode_shlibpath_var" = no; then
  1376.           case ":$compile_shlibpath:" in
  1377.           *":$dir:"*) ;;
  1378.           *) compile_shlibpath="$compile_shlibpath$dir:";;
  1379.           esac
  1380.           compile_command="$compile_command -l$name"
  1381.           deplibs="$deplibs -l$name"
  1382.         else
  1383.           lib_linked=no
  1384.         fi
  1385.         ;;
  1386.  
  1387.       relink)
  1388.         if test "$hardcode_direct" = yes; then
  1389.           compile_command="$compile_command $absdir/$linklib"
  1390.           deplibs="$deplibs $absdir/$linklib"
  1391.         elif test "$hardcode_minus_L" = yes; then
  1392.           case "$compile_command " in
  1393.           *" -L$absdir "*) ;;
  1394.           *) compile_command="$compile_command -L$absdir";;
  1395.           esac
  1396.           compile_command="$compile_command -l$name"
  1397.           deplibs="$deplibs -L$absdir -l$name"
  1398.         elif test "$hardcode_shlibpath_var" = yes; then
  1399.           case ":$compile_shlibpath:" in
  1400.           *":$absdir:"*) ;;
  1401.           *) compile_shlibpath="$compile_shlibpath$absdir:";;
  1402.           esac
  1403.           compile_command="$compile_command -l$name"
  1404.           deplibs="$deplibs -l$name"
  1405.         else
  1406.           lib_linked=no
  1407.         fi
  1408.         ;;
  1409.  
  1410.       *)
  1411.         lib_linked=no
  1412.         ;;
  1413.       esac
  1414.  
  1415.       if test "$lib_linked" != yes; then
  1416.         $echo "$modename: configuration error: unsupported hardcode properties"
  1417.         exit 1
  1418.       fi
  1419.  
  1420.       # Finalize command for both is simple: just hardcode it.
  1421.       if test "$hardcode_direct" = yes; then
  1422.         finalize_command="$finalize_command $libdir/$linklib"
  1423.       elif test "$hardcode_minus_L" = yes; then
  1424.         case "$finalize_command " in
  1425.         *" -L$libdir "*) ;;
  1426.         *) finalize_command="$finalize_command -L$libdir";;
  1427.         esac
  1428.         finalize_command="$finalize_command -l$name"
  1429.       elif test "$hardcode_shlibpath_var" = yes; then
  1430.         case ":$finalize_shlibpath:" in
  1431.         *":$libdir:"*) ;;
  1432.         *) finalize_shlibpath="$finalize_shlibpath$libdir:";;
  1433.         esac
  1434.         finalize_command="$finalize_command -l$name"
  1435.       else
  1436.         # We cannot seem to hardcode it, guess we'll fake it.
  1437.         case "$finalize_command " in
  1438.         *" -L$dir "*) ;;
  1439.         *) finalize_command="$finalize_command -L$libdir";;
  1440.         esac
  1441.         finalize_command="$finalize_command -l$name"
  1442.       fi
  1443.     else
  1444.       # Transform directly to old archives if we don't build new libraries.
  1445.       if test -n "$pic_flag" && test -z "$old_library"; then
  1446.         $echo "$modename: cannot find static library for \`$arg'" 1>&2
  1447.         exit 1
  1448.       fi
  1449.  
  1450.       # Here we assume that one of hardcode_direct or hardcode_minus_L
  1451.       # is not unsupported.  This is valid on all known static and
  1452.       # shared platforms.
  1453.       if test "$hardcode_direct" != unsupported; then
  1454.         test -n "$old_library" && linklib="$old_library"
  1455.         compile_command="$compile_command $dir/$linklib"
  1456.         finalize_command="$finalize_command $dir/$linklib"
  1457.       else
  1458.         case "$compile_command " in
  1459.         *" -L$dir "*) ;;
  1460.         *) compile_command="$compile_command -L$dir";;
  1461.         esac
  1462.         compile_command="$compile_command -l$name"
  1463.         case "$finalize_command " in
  1464.         *" -L$dir "*) ;;
  1465.         *) finalize_command="$finalize_command -L$dir";;
  1466.         esac
  1467.         finalize_command="$finalize_command -l$name"
  1468.       fi
  1469.     fi
  1470.  
  1471.     # Add in any libraries that this one depends upon.
  1472.     compile_command="$compile_command$dependency_libs"
  1473.     finalize_command="$finalize_command$dependency_libs"
  1474.     continue
  1475.     ;;
  1476.  
  1477.       # Some other compiler argument.
  1478.       *)
  1479.     # Unknown arguments in both finalize_command and compile_command need
  1480.     # to be aesthetically quoted because they are evaled later.
  1481.     arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1482.     case "$arg" in
  1483.     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*)
  1484.       arg="\"$arg\""
  1485.       ;;
  1486.     esac
  1487.     ;;
  1488.       esac
  1489.  
  1490.       # Now actually substitute the argument into the commands.
  1491.       if test -n "$arg"; then
  1492.     compile_command="$compile_command $arg"
  1493.     finalize_command="$finalize_command $arg"
  1494.       fi
  1495.     done
  1496.  
  1497.     if test -n "$prev"; then
  1498.       $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
  1499.       $echo "$help" 1>&2
  1500.       exit 1
  1501.     fi
  1502.  
  1503.     if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
  1504.       eval arg=\"$export_dynamic_flag_spec\"
  1505.       compile_command="$compile_command $arg"
  1506.       finalize_command="$finalize_command $arg"
  1507.     fi
  1508.  
  1509.     oldlibs=
  1510.     # calculate the name of the file, without its directory
  1511.     outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
  1512.     libobjs_save="$libobjs"
  1513.  
  1514.     case "$output" in
  1515.     "")
  1516.       $echo "$modename: you must specify an output file" 1>&2
  1517.       $echo "$help" 1>&2
  1518.       exit 1
  1519.       ;;
  1520.  
  1521.     *.a | *.lib)
  1522.       if test -n "$link_against_libtool_libs"; then
  1523.     $echo "$modename: error: cannot link libtool libraries into archives" 1>&2
  1524.     exit 1
  1525.       fi
  1526.  
  1527.       if test -n "$deplibs"; then
  1528.     $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
  1529.       fi
  1530.  
  1531.       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  1532.     $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
  1533.       fi
  1534.  
  1535.       if test -n "$rpath"; then
  1536.     $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
  1537.       fi
  1538.  
  1539.       if test -n "$xrpath"; then
  1540.     $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
  1541.       fi
  1542.  
  1543.       if test -n "$vinfo"; then
  1544.     $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
  1545.       fi
  1546.  
  1547.       if test -n "$release"; then
  1548.     $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
  1549.       fi
  1550.  
  1551.       if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  1552.     $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
  1553.       fi
  1554.  
  1555.       # Now set the variables for building old libraries.
  1556.       build_libtool_libs=no
  1557.       oldlibs="$output"
  1558.       ;;
  1559.  
  1560.     *.la)
  1561.       # Make sure we only generate libraries of the form `libNAME.la'.
  1562.       case "$outputname" in
  1563.       lib*)
  1564.     name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
  1565.     eval libname=\"$libname_spec\"
  1566.     ;;
  1567.       *)
  1568.     if test "$module" = no; then
  1569.       $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
  1570.       $echo "$help" 1>&2
  1571.       exit 1
  1572.     fi
  1573.     if test "$need_lib_prefix" != no; then
  1574.       # Add the "lib" prefix for modules if required
  1575.       name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
  1576.       eval libname=\"$libname_spec\"
  1577.     else
  1578.       libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
  1579.     fi
  1580.     ;;
  1581.       esac
  1582.  
  1583.       output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
  1584.       if test "X$output_objdir" = "X$output"; then
  1585.     output_objdir="$objdir"
  1586.       else
  1587.     output_objdir="$output_objdir/$objdir"
  1588.       fi
  1589.  
  1590.       if test -n "$objs"; then
  1591.     $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
  1592.     exit 1
  1593.       fi
  1594.  
  1595.       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  1596.     $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2
  1597.       fi
  1598.  
  1599.       set dummy $rpath
  1600.       if test $# -gt 2; then
  1601.     $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
  1602.       fi
  1603.       install_libdir="$2"
  1604.  
  1605.       oldlibs=
  1606.       if test -z "$rpath"; then
  1607.     if test "$build_libtool_libs" = yes; then
  1608.       # Building a libtool convenience library.
  1609.       libext=al
  1610.       oldlibs="$output_objdir/$libname.$libext $oldlibs"
  1611.       build_libtool_libs=convenience
  1612.       build_old_libs=yes
  1613.     fi
  1614.     dependency_libs="$deplibs"
  1615.  
  1616.     if test -n "$vinfo"; then
  1617.       $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
  1618.     fi
  1619.  
  1620.     if test -n "$release"; then
  1621.       $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
  1622.     fi
  1623.       else
  1624.  
  1625.     # Parse the version information argument.
  1626.     IFS="${IFS=     }"; save_ifs="$IFS"; IFS=':'
  1627.     set dummy $vinfo 0 0 0
  1628.     IFS="$save_ifs"
  1629.  
  1630.     if test -n "$8"; then
  1631.       $echo "$modename: too many parameters to \`-version-info'" 1>&2
  1632.       $echo "$help" 1>&2
  1633.       exit 1
  1634.     fi
  1635.  
  1636.     current="$2"
  1637.     revision="$3"
  1638.     age="$4"
  1639.  
  1640.     # Check that each of the things are valid numbers.
  1641.     case "$current" in
  1642.     0 | [1-9] | [1-9][0-9]*) ;;
  1643.     *)
  1644.       $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
  1645.       $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1646.       exit 1
  1647.       ;;
  1648.     esac
  1649.  
  1650.     case "$revision" in
  1651.     0 | [1-9] | [1-9][0-9]*) ;;
  1652.     *)
  1653.       $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
  1654.       $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1655.       exit 1
  1656.       ;;
  1657.     esac
  1658.  
  1659.     case "$age" in
  1660.     0 | [1-9] | [1-9][0-9]*) ;;
  1661.     *)
  1662.       $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
  1663.       $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1664.       exit 1
  1665.       ;;
  1666.     esac
  1667.  
  1668.     if test $age -gt $current; then
  1669.       $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
  1670.       $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1671.       exit 1
  1672.     fi
  1673.  
  1674.     # Calculate the version variables.
  1675.     major=
  1676.     versuffix=
  1677.     verstring=
  1678.     case "$version_type" in
  1679.     none) ;;
  1680.  
  1681.     irix)
  1682.       major=`expr $current - $age + 1`
  1683.       versuffix="$major.$revision"
  1684.       verstring="sgi$major.$revision"
  1685.  
  1686.       # Add in all the interfaces that we are compatible with.
  1687.       loop=$revision
  1688.       while test $loop != 0; do
  1689.         iface=`expr $revision - $loop`
  1690.         loop=`expr $loop - 1`
  1691.         verstring="sgi$major.$iface:$verstring"
  1692.       done
  1693.       ;;
  1694.  
  1695.     linux)
  1696.       major=.`expr $current - $age`
  1697.       versuffix="$major.$age.$revision"
  1698.       ;;
  1699.  
  1700.     osf)
  1701.       major=`expr $current - $age`
  1702.       versuffix=".$current.$age.$revision"
  1703.       verstring="$current.$age.$revision"
  1704.  
  1705.       # Add in all the interfaces that we are compatible with.
  1706.       loop=$age
  1707.       while test $loop != 0; do
  1708.         iface=`expr $current - $loop`
  1709.         loop=`expr $loop - 1`
  1710.         verstring="$verstring:${iface}.0"
  1711.       done
  1712.  
  1713.       # Make executables depend on our current version.
  1714.       verstring="$verstring:${current}.0"
  1715.       ;;
  1716.  
  1717.     sunos)
  1718.       major=".$current"
  1719.       versuffix=".$current.$revision"
  1720.       ;;
  1721.  
  1722.     freebsd-aout)
  1723.       major=".$current"
  1724.       versuffix=".$current.$revision";
  1725.       ;;
  1726.  
  1727.     freebsd-elf)
  1728.       major=".$current"
  1729.       versuffix=".$current";
  1730.       ;;
  1731.  
  1732.     windows)
  1733.       # Like Linux, but with '-' rather than '.', since we only
  1734.       # want one extension on Windows 95.
  1735.       major=`expr $current - $age`
  1736.       versuffix="-$major-$age-$revision"
  1737.       ;;
  1738.  
  1739.     *)
  1740.       $echo "$modename: unknown library version type \`$version_type'" 1>&2
  1741.       echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
  1742.       exit 1
  1743.       ;;
  1744.     esac
  1745.  
  1746.     # Clear the version info if we defaulted, and they specified a release.
  1747.     if test -z "$vinfo" && test -n "$release"; then
  1748.       major=
  1749.       verstring="0.0"
  1750.       if test "$need_version" = no; then
  1751.         versuffix=
  1752.       else
  1753.         versuffix=".0.0"
  1754.       fi
  1755.     fi
  1756.  
  1757.     # Remove version info from name if versioning should be avoided
  1758.     if test "$avoid_version" = yes && test "$need_version" = no; then
  1759.       major=
  1760.       versuffix=
  1761.       verstring=""
  1762.     fi
  1763.     
  1764.     # Check to see if the archive will have undefined symbols.
  1765.     if test "$allow_undefined" = yes; then
  1766.       if test "$allow_undefined_flag" = unsupported; then
  1767.         $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
  1768.         build_libtool_libs=no
  1769.         build_old_libs=yes
  1770.       fi
  1771.     else
  1772.       # Don't allow undefined symbols.
  1773.       allow_undefined_flag="$no_undefined_flag"
  1774.     fi
  1775.  
  1776.     dependency_libs="$deplibs"
  1777.     case "$host" in
  1778.     *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
  1779.       # these systems don't actually have a c library (as such)!
  1780.       ;;
  1781.     *-*-freebsd*)
  1782.       # FreeBSD doesn't need this...
  1783.       ;;
  1784.     *)
  1785.       # Add libc to deplibs on all other systems.
  1786.       deplibs="$deplibs -lc"
  1787.       ;;
  1788.     esac
  1789.       fi
  1790.  
  1791.       if test -n "$rpath$xrpath"; then
  1792.     # If the user specified any rpath flags, then add them.
  1793.     for libdir in $rpath $xrpath; do
  1794.       # This is the magic to use -rpath.
  1795.       case "$compile_rpath " in
  1796.       *" $libdir "*) ;;
  1797.       *) compile_rpath="$compile_rpath $libdir" ;;
  1798.       esac
  1799.       case "$finalize_rpath " in
  1800.       *" $libdir "*) ;;
  1801.       *) finalize_rpath="$finalize_rpath $libdir" ;;
  1802.       esac
  1803.     done
  1804.       fi
  1805.  
  1806.       # Now hardcode the library paths
  1807.       rpath=
  1808.       hardcode_libdirs=
  1809.       for libdir in $compile_rpath; do
  1810.     if test -n "$hardcode_libdir_flag_spec"; then
  1811.       if test -n "$hardcode_libdir_separator"; then
  1812.         if test -z "$hardcode_libdirs"; then
  1813.           hardcode_libdirs="$libdir"
  1814.         else
  1815.           # Just accumulate the unique libdirs.
  1816.           case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
  1817.           *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  1818.         ;;
  1819.           *)
  1820.         hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  1821.         ;;
  1822.           esac
  1823.         fi
  1824.       else
  1825.         eval flag=\"$hardcode_libdir_flag_spec\"
  1826.         rpath="$rpath $flag"
  1827.       fi
  1828.     elif test -n "$runpath_var"; then
  1829.       case "$perm_rpath " in
  1830.       *" $libdir "*) ;;
  1831.       *) perm_rpath="$perm_rpath $libdir" ;;
  1832.       esac
  1833.     fi
  1834.       done
  1835.       # Substitute the hardcoded libdirs into the rpath.
  1836.       if test -n "$hardcode_libdir_separator" &&
  1837.      test -n "$hardcode_libdirs"; then
  1838.     libdir="$hardcode_libdirs"
  1839.     eval rpath=\" $hardcode_libdir_flag_spec\"
  1840.       fi
  1841.       compile_rpath="$rpath"
  1842.  
  1843.       rpath=
  1844.       hardcode_libdirs=
  1845.       for libdir in $finalize_rpath; do
  1846.     if test -n "$hardcode_libdir_flag_spec"; then
  1847.       if test -n "$hardcode_libdir_separator"; then
  1848.         if test -z "$hardcode_libdirs"; then
  1849.           hardcode_libdirs="$libdir"
  1850.         else
  1851.           # Just accumulate the unique libdirs.
  1852.           case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
  1853.           *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  1854.         ;;
  1855.           *)
  1856.         hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  1857.         ;;
  1858.           esac
  1859.         fi
  1860.       else
  1861.         eval flag=\"$hardcode_libdir_flag_spec\"
  1862.         rpath="$rpath $flag"
  1863.       fi
  1864.     elif test -n "$runpath_var"; then
  1865.       case "$finalize_perm_rpath " in
  1866.       *" $libdir "*) ;;
  1867.       *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
  1868.       esac
  1869.     fi
  1870.       done
  1871.       # Substitute the hardcoded libdirs into the rpath.
  1872.       if test -n "$hardcode_libdir_separator" &&
  1873.      test -n "$hardcode_libdirs"; then
  1874.     libdir="$hardcode_libdirs"
  1875.     eval rpath=\" $hardcode_libdir_flag_spec\"
  1876.       fi
  1877.       finalize_rpath="$rpath"
  1878.  
  1879.       # Create the output directory, or remove our outputs if we need to.
  1880.       if test -d $output_objdir; then
  1881.     $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
  1882.     $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
  1883.       else
  1884.     $show "$mkdir $output_objdir"
  1885.     $run $mkdir $output_objdir
  1886.     status=$?
  1887.     if test $status -ne 0 && test ! -d $output_objdir; then
  1888.       exit $status
  1889.     fi
  1890.       fi
  1891.  
  1892.       # Now set the variables for building old libraries.
  1893.       if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
  1894.     if test "$release_suffix" = all; then
  1895.      oldlibs="$oldlibs $output_objdir/$libname$release.$libext"
  1896.     else
  1897.      oldlibs="$oldlibs $output_objdir/$libname.$libext"
  1898.     fi
  1899.  
  1900.     # Transform .lo files to .o files.
  1901.     oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
  1902.       fi
  1903.  
  1904.       if test "$build_libtool_libs" = yes; then
  1905.     # Transform deplibs into only deplibs that can be linked in shared.
  1906.     name_save=$name
  1907.     libname_save=$libname
  1908.     release_save=$release
  1909.     versuffix_save=$versuffix
  1910.     major_save=$major
  1911.     # I'm not sure if I'm treating the release correctly.  I think
  1912.     # release should show up in the -l (ie -lgmp5) so we don't want to
  1913.     # add it in twice.  Is that correct?
  1914.     release=""
  1915.     versuffix=""
  1916.     major=""
  1917.     newdeplibs=
  1918.     droppeddeps=no
  1919.     case "$deplibs_check_method" in
  1920.     pass_all)
  1921.       # Don't check for shared/static.  Everything works.
  1922.       # This might be a little naive.  We might want to check
  1923.       # whether the library exists or not.  But this is on
  1924.       # osf3 & osf4 and I'm not really sure... Just
  1925.       # implementing what was already the behaviour.
  1926.       newdeplibs=$deplibs
  1927.       ;;
  1928.     test_compile)
  1929.       # This code stresses the "libraries are programs" paradigm to its
  1930.       # limits. Maybe even breaks it.  We compile a program, linking it
  1931.       # against the deplibs as a proxy for the library.  Then we can check
  1932.       # whether they linked in statically or dynamically with ldd.
  1933.       $rm conftest.c
  1934.       cat > conftest.c <<EOF
  1935.       int main() { return 0; }
  1936. EOF
  1937.       $rm conftest
  1938.       $CC -o conftest conftest.c $deplibs
  1939.       if test $? -eq 0 ; then
  1940.         ldd_output=`ldd conftest`
  1941.         for i in $deplibs; do
  1942.           name="`expr $i : '-l\(.*\)'`"
  1943.           # If $name is empty we are operating on a -L argument.
  1944.           if test "$name" != "" ; then
  1945.         libname=`eval \\$echo \"$libname_spec\"`
  1946.         deplib_matches=`eval \\$echo \"$library_names_spec\"`
  1947.         set dummy $deplib_matches
  1948.         deplib_match=$2
  1949.         if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  1950.           newdeplibs="$newdeplibs $i"
  1951.         else
  1952.           droppeddeps=yes
  1953.           echo
  1954.           echo "*** Warning: This library needs some functionality provided by $i."
  1955.           echo "*** I have the capability to make that library automatically link in when"
  1956.           echo "*** you link to this library.  But I can only do this if you have a"
  1957.           echo "*** shared version of the library, which you do not appear to have."
  1958.         fi
  1959.           else
  1960.         newdeplibs="$newdeplibs $i"
  1961.           fi
  1962.         done
  1963.       else
  1964.         # Error occured in the first compile.  Let's try to salvage the situation:
  1965.         # Compile a seperate program for each library.
  1966.         for i in $deplibs; do
  1967.           name="`expr $i : '-l\(.*\)'`"
  1968.          # If $name is empty we are operating on a -L argument.
  1969.           if test "$name" != "" ; then
  1970.         $rm conftest
  1971.         $CC -o conftest conftest.c $i
  1972.         # Did it work?
  1973.         if test $? -eq 0 ; then
  1974.           ldd_output=`ldd conftest`
  1975.           libname=`eval \\$echo \"$libname_spec\"`
  1976.           deplib_matches=`eval \\$echo \"$library_names_spec\"`
  1977.           set dummy $deplib_matches
  1978.           deplib_match=$2
  1979.           if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  1980.             newdeplibs="$newdeplibs $i"
  1981.           else
  1982.             droppeddeps=yes
  1983.             echo
  1984.             echo "*** Warning: This library needs some functionality provided by $i."
  1985.             echo "*** I have the capability to make that library automatically link in when"
  1986.             echo "*** you link to this library.  But I can only do this if you have a"
  1987.             echo "*** shared version of the library, which you do not appear to have."
  1988.           fi
  1989.         else
  1990.           droppeddeps=yes
  1991.           echo
  1992.           echo "*** Warning!  Library $i is needed by this library but I was not able to"
  1993.           echo "***  make it link in!  You will probably need to install it or some"
  1994.           echo "*** library that it depends on before this library will be fully"
  1995.           echo "*** functional.  Installing it before continuing would be even better."
  1996.         fi
  1997.           else
  1998.         newdeplibs="$newdeplibs $i"
  1999.           fi
  2000.         done
  2001.       fi
  2002.       ;;
  2003.     file_magic*)
  2004.       set dummy $deplibs_check_method
  2005.       file_magic_regex="`expr \"$deplibs_check_method\" : \"$2 \(.*\)\"`"
  2006.       for a_deplib in $deplibs; do
  2007.         name="`expr $a_deplib : '-l\(.*\)'`"
  2008.         # If $name is empty we are operating on a -L argument.
  2009.         if test "$name" != "" ; then
  2010.           libname=`eval \\$echo \"$libname_spec\"`
  2011.           for i in $lib_search_path; do
  2012.             potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
  2013.             for potent_lib in $potential_libs; do
  2014.               # Follow soft links.
  2015.               if ls -lLd "$potent_lib" 2>/dev/null \
  2016.              | grep " -> " >/dev/null; then
  2017.             continue 
  2018.               fi
  2019.               # The statement above tries to avoid entering an
  2020.               # endless loop below, in case of cyclic links.
  2021.               # We might still enter an endless loop, since a link
  2022.               # loop can be closed while we follow links,
  2023.               # but so what?
  2024.               potlib="$potent_lib"
  2025.               while test -h "$potlib" 2>/dev/null; do
  2026.             potliblink=`ls -ld $potlib | sed 's/.* -> //'`
  2027.             case "$potliblink" in
  2028.             [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
  2029.             *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
  2030.             esac
  2031.               done
  2032.               if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
  2033.              | sed 10q \
  2034.              | egrep "$file_magic_regex" > /dev/null; then
  2035.             newdeplibs="$newdeplibs $a_deplib"
  2036.             a_deplib=""
  2037.             break 2
  2038.               fi
  2039.             done
  2040.           done
  2041.           if test -n "$a_deplib" ; then
  2042.         droppeddeps=yes
  2043.         echo
  2044.         echo "*** Warning: This library needs some functionality provided by $a_deplib."
  2045.         echo "*** I have the capability to make that library automatically link in when"
  2046.         echo "*** you link to this library.  But I can only do this if you have a"
  2047.         echo "*** shared version of the library, which you do not appear to have."
  2048.           fi
  2049.         else
  2050.           # Add a -L argument.
  2051.           newdeplibs="$newdeplibs $a_deplib"
  2052.         fi
  2053.       done # Gone through all deplibs.
  2054.       ;;
  2055.     none | unknown | *)
  2056.       newdeplibs=""
  2057.       if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
  2058.            -e 's/ -[LR][^ ]*//g' -e 's/[     ]//g' |
  2059.          grep . >/dev/null; then
  2060.         echo
  2061.         if test "X$deplibs_check_method" = "Xnone"; then
  2062.           echo "*** Warning: inter-library dependencies are not supported in this platform."
  2063.         else
  2064.           echo "*** Warning: inter-library dependencies are not known to be supported."
  2065.         fi
  2066.         echo "*** All declared inter-library dependencies are being dropped."
  2067.         droppeddeps=yes
  2068.       fi
  2069.       ;;
  2070.     esac
  2071.     versuffix=$versuffix_save
  2072.     major=$major_save
  2073.     release=$release_save
  2074.     libname=$libname_save
  2075.     name=$name_save
  2076.  
  2077.     if test "$droppeddeps" = yes; then
  2078.       if test "$module" = yes; then
  2079.         echo
  2080.         echo "*** Warning: libtool could not satisfy all declared inter-library"
  2081.         echo "*** dependencies of module $libname.  Therefore, libtool will create"
  2082.         echo "*** a static module, that should work as long as the dlopening"
  2083.         echo "*** application is linked with the -dlopen flag."
  2084.         if test -z "$global_symbol_pipe"; then
  2085.           echo
  2086.           echo "*** However, this would only work if libtool was able to extract symbol"
  2087.           echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
  2088.           echo "*** not find such a program.  So, this module is probably useless."
  2089.           echo "*** \`nm' from GNU binutils and a full rebuild may help."
  2090.         fi
  2091.         if test "$build_old_libs" = no; then
  2092.           if test "$release_suffix" = all; then
  2093.             oldlibs="$output_objdir/$libname$release.$libext"
  2094.           else
  2095.             oldlibs="$output_objdir/$libname.$libext"
  2096.           fi
  2097.           build_libtool_libs=module
  2098.           build_old_libs=yes
  2099.         else
  2100.           build_libtool_libs=no
  2101.         fi
  2102.       else
  2103.         echo "*** The inter-library dependencies that have been dropped here will be"
  2104.         echo "*** automatically added whenever a program is linked with this library"
  2105.         echo "*** or is declared to -dlopen it."
  2106.       fi
  2107.     fi
  2108.     # Done checking deplibs!
  2109.     deplibs=$newdeplibs
  2110.       fi
  2111.  
  2112.       # All the library-specific variables (install_libdir is set above).
  2113.       library_names=
  2114.       old_library=
  2115.       dlname=
  2116.       
  2117.       # Test again, we may have decided not to build it any more
  2118.       if test "$build_libtool_libs" = yes; then
  2119.     # Get the real and link names of the library.
  2120.     eval library_names=\"$library_names_spec\"
  2121.     set dummy $library_names
  2122.     realname="$2"
  2123.     shift; shift
  2124.  
  2125.     if test -n "$soname_spec"; then
  2126.       eval soname=\"$soname_spec\"
  2127.     else
  2128.       soname="$realname"
  2129.     fi
  2130.  
  2131.     lib="$output_objdir/$realname"
  2132.     for link
  2133.     do
  2134.       linknames="$linknames $link"
  2135.     done
  2136.  
  2137.     # Ensure that we have .o objects for linkers which dislike .lo
  2138.     # (e.g. aix) in case we are running --disable-static
  2139.     for obj in $libobjs; do
  2140.       xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
  2141.       if test "X$xdir" = "X$obj"; then
  2142.         xdir="."
  2143.       else
  2144.         xdir="$xdir"
  2145.       fi
  2146.       baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
  2147.       oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
  2148.       if test ! -f $xdir/$oldobj; then
  2149.         $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
  2150.         $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
  2151.       fi
  2152.     done
  2153.  
  2154.     # Use standard objects if they are pic
  2155.     test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  2156.  
  2157.     # Prepare the list of exported symbols
  2158.     if test -z "$export_symbols"; then
  2159.       if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
  2160.         $show "generating symbol list for \`$libname.la'"
  2161.         export_symbols="$output_objdir/$libname.exp"
  2162.         $run $rm $export_symbols
  2163.         eval cmds=\"$export_symbols_cmds\"
  2164.         IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
  2165.         for cmd in $cmds; do
  2166.           IFS="$save_ifs"
  2167.           $show "$cmd"
  2168.           $run eval "$cmd" || exit $?
  2169.         done
  2170.         IFS="$save_ifs"
  2171.         if test -n "$export_symbols_regex"; then
  2172.           $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
  2173.           $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  2174.           $show "$mv \"${export_symbols}T\" \"$export_symbols\""
  2175.           $run eval '$mv "${export_symbols}T" "$export_symbols"'
  2176.         fi
  2177.       fi
  2178.     fi
  2179.  
  2180.     if test -n "$export_symbols" && test -n "$include_expsyms"; then
  2181.       $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
  2182.     fi
  2183.  
  2184.     if test -n "$convenience"; then
  2185.       if test -n "$whole_archive_flag_spec"; then
  2186.         eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  2187.       else
  2188.         gentop="$output_objdir/${outputname}x"
  2189.         $show "${rm}r $gentop"
  2190.         $run ${rm}r "$gentop"
  2191.         $show "mkdir $gentop"
  2192.         $run mkdir "$gentop"
  2193.         status=$?
  2194.         if test $status -ne 0 && test ! -d "$gentop"; then
  2195.           exit $status
  2196.         fi
  2197.         generated="$generated $gentop"
  2198.  
  2199.         for xlib in $convenience; do
  2200.           # Extract the objects.
  2201.           case "$xlib" in
  2202.           [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
  2203.           *) xabs=`pwd`"/$xlib" ;;
  2204.           esac
  2205.           xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
  2206.           xdir="$gentop/$xlib"
  2207.  
  2208.           $show "${rm}r $xdir"
  2209.           $run ${rm}r "$xdir"
  2210.           $show "mkdir $xdir"
  2211.           $run mkdir "$xdir"
  2212.           status=$?
  2213.           if test $status -ne 0 && test ! -d "$xdir"; then
  2214.         exit $status
  2215.           fi
  2216.           $show "(cd $xdir && $AR x $xabs)"
  2217.           $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
  2218.  
  2219.           libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
  2220.         done
  2221.       fi
  2222.     fi
  2223.  
  2224.     if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
  2225.       eval flag=\"$thread_safe_flag_spec\"
  2226.       linkopts="$linkopts $flag"
  2227.     fi
  2228.  
  2229.     # Do each of the archive commands.
  2230.     if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  2231.       eval cmds=\"$archive_expsym_cmds\"
  2232.     else
  2233.       eval cmds=\"$archive_cmds\"
  2234.     fi
  2235.     IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
  2236.     for cmd in $cmds; do
  2237.       IFS="$save_ifs"
  2238.       $show "$cmd"
  2239.       $run eval "$cmd" || exit $?
  2240.     done
  2241.     IFS="$save_ifs"
  2242.  
  2243.     # Create links to the real library.
  2244.     for linkname in $linknames; do
  2245.       if test "$realname" != "$linkname"; then
  2246.         $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
  2247.         $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
  2248.       fi
  2249.     done
  2250.  
  2251.     # If -module or -export-dynamic was specified, set the dlname.
  2252.     if test "$module" = yes || test "$export_dynamic" = yes; then
  2253.       # On all known operating systems, these are identical.
  2254.       dlname="$soname"
  2255.     fi
  2256.       fi
  2257.       ;;
  2258.  
  2259.     *.lo | *.o | *.obj)
  2260.       if test -n "$link_against_libtool_libs"; then
  2261.     $echo "$modename: error: cannot link libtool libraries into objects" 1>&2
  2262.     exit 1
  2263.       fi
  2264.  
  2265.       if test -n "$deplibs"; then
  2266.     $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
  2267.       fi
  2268.  
  2269.       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  2270.     $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
  2271.       fi
  2272.  
  2273.       if test -n "$rpath"; then
  2274.     $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
  2275.       fi
  2276.  
  2277.       if test -n "$xrpath"; then
  2278.     $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
  2279.       fi
  2280.  
  2281.       if test -n "$vinfo"; then
  2282.     $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
  2283.       fi
  2284.  
  2285.       if test -n "$release"; then
  2286.     $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
  2287.       fi
  2288.  
  2289.       case "$output" in
  2290.       *.lo)
  2291.     if test -n "$objs"; then
  2292.       $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
  2293.       exit 1
  2294.     fi
  2295.     libobj="$output"
  2296.     obj=`$echo "X$output" | $Xsed -e "$lo2o"`
  2297.     ;;
  2298.       *)
  2299.     libobj=
  2300.     obj="$output"
  2301.     ;;
  2302.       esac
  2303.  
  2304.       # Delete the old objects.
  2305.       $run $rm $obj $libobj
  2306.  
  2307.       # Objects from convenience libraries.  This assumes
  2308.       # single-version convenience libraries.  Whenever we create
  2309.       # different ones for PIC/non-PIC, this we'll have to duplicate
  2310.       # the extraction.
  2311.       reload_conv_objs=
  2312.       gentop=
  2313.       # reload_cmds runs $LD directly, so let us get rid of
  2314.       # -Wl from whole_archive_flag_spec
  2315.       wl= 
  2316.  
  2317.       if test -n "$convenience"; then
  2318.     if test -n "$whole_archive_flag_spec"; then
  2319.       eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
  2320.     else
  2321.       gentop="$output_objdir/${obj}x"
  2322.       $show "${rm}r $gentop"
  2323.       $run ${rm}r "$gentop"
  2324.       $show "mkdir $gentop"
  2325.       $run mkdir "$gentop"
  2326.       status=$?
  2327.       if test $status -ne 0 && test ! -d "$gentop"; then
  2328.         exit $status
  2329.       fi
  2330.       generated="$generated $gentop"
  2331.  
  2332.       for xlib in $convenience; do
  2333.         # Extract the objects.
  2334.         case "$xlib" in
  2335.         [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
  2336.         *) xabs=`pwd`"/$xlib" ;;
  2337.         esac
  2338.         xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
  2339.         xdir="$gentop/$xlib"
  2340.  
  2341.         $show "${rm}r $xdir"
  2342.         $run ${rm}r "$xdir"
  2343.         $show "mkdir $xdir"
  2344.         $run mkdir "$xdir"
  2345.         status=$?
  2346.         if test $status -ne 0 && test ! -d "$xdir"; then
  2347.           exit $status
  2348.         fi
  2349.         $show "(cd $xdir && $AR x $xabs)"
  2350.         $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
  2351.  
  2352.         reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
  2353.       done
  2354.     fi
  2355.       fi
  2356.  
  2357.       # Create the old-style object.
  2358.       reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs"
  2359.  
  2360.       output="$obj"
  2361.       eval cmds=\"$reload_cmds\"
  2362.       IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
  2363.       for cmd in $cmds; do
  2364.     IFS="$save_ifs"
  2365.     $show "$cmd"
  2366.     $run eval "$cmd" || exit $?
  2367.       done
  2368.       IFS="$save_ifs"
  2369.  
  2370.       # Exit if we aren't doing a library object file.
  2371.       if test -z "$libobj"; then
  2372.     if test -n "$gentop"; then
  2373.       $show "${rm}r $gentop"
  2374.       $run ${rm}r $gentop
  2375.     fi
  2376.  
  2377.     exit 0
  2378.       fi
  2379.  
  2380.       if test "$build_libtool_libs" != yes; then
  2381.     if test -n "$gentop"; then
  2382.       $show "${rm}r $gentop"
  2383.       $run ${rm}r $gentop
  2384.     fi
  2385.  
  2386.     # Create an invalid libtool object if no PIC, so that we don't
  2387.     # accidentally link it into a program.
  2388.     $show "echo timestamp > $libobj"
  2389.     $run eval "echo timestamp > $libobj" || exit $?
  2390.     exit 0
  2391.       fi
  2392.  
  2393.       if test -n "$pic_flag"; then
  2394.     # Only do commands if we really have different PIC objects.
  2395.     reload_objs="$libobjs $reload_conv_objs"
  2396.     output="$libobj"
  2397.     eval cmds=\"$reload_cmds\"
  2398.     IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
  2399.     for cmd in $cmds; do
  2400.       IFS="$save_ifs"
  2401.       $show "$cmd"
  2402.       $run eval "$cmd" || exit $?
  2403.     done
  2404.     IFS="$save_ifs"
  2405.       else
  2406.     # Just create a symlink.
  2407.     $show $rm $libobj
  2408.     $run $rm $libobj
  2409.     xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
  2410.     if test "X$xdir" = "X$libobj"; then
  2411.       xdir="."
  2412.     else
  2413.       xdir="$xdir"
  2414.     fi
  2415.     baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
  2416.     oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
  2417.     $show "(cd $xdir && $LN_S $oldobj $baseobj)"
  2418.     $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
  2419.       fi
  2420.  
  2421.       if test -n "$gentop"; then
  2422.     $show "${rm}r $gentop"
  2423.     $run ${rm}r $gentop
  2424.       fi
  2425.  
  2426.       exit 0
  2427.       ;;
  2428.  
  2429.     # Anything else should be a program.
  2430.     *)
  2431.       if test -n "$vinfo"; then
  2432.     $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
  2433.       fi
  2434.  
  2435.       if test -n "$release"; then
  2436.     $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
  2437.       fi
  2438.  
  2439.       if test "$preload" = yes; then
  2440.     if test "$dlopen" = unknown && test "$dlopen_self" = unknown &&
  2441.        test "$dlopen_self_static" = unknown; then
  2442.       $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
  2443.     fi 
  2444.       fi
  2445.     
  2446.       if test -n "$rpath$xrpath"; then
  2447.     # If the user specified any rpath flags, then add them.
  2448.     for libdir in $rpath $xrpath; do
  2449.       # This is the magic to use -rpath.
  2450.       case "$compile_rpath " in
  2451.       *" $libdir "*) ;;
  2452.       *) compile_rpath="$compile_rpath $libdir" ;;
  2453.       esac
  2454.       case "$finalize_rpath " in
  2455.       *" $libdir "*) ;;
  2456.       *) finalize_rpath="$finalize_rpath $libdir" ;;
  2457.       esac
  2458.     done
  2459.       fi
  2460.  
  2461.       # Now hardcode the library paths
  2462.       rpath=
  2463.       hardcode_libdirs=
  2464.       for libdir in $compile_rpath $finalize_rpath; do
  2465.     if test -n "$hardcode_libdir_flag_spec"; then
  2466.       if test -n "$hardcode_libdir_separator"; then
  2467.         if test -z "$hardcode_libdirs"; then
  2468.           hardcode_libdirs="$libdir"
  2469.         else
  2470.           # Just accumulate the unique libdirs.
  2471.           case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
  2472.           *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  2473.         ;;
  2474.           *)
  2475.         hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  2476.         ;;
  2477.           esac
  2478.         fi
  2479.       else
  2480.         eval flag=\"$hardcode_libdir_flag_spec\"
  2481.         rpath="$rpath $flag"
  2482.       fi
  2483.     elif test -n "$runpath_var"; then
  2484.       case "$perm_rpath " in
  2485.       *" $libdir "*) ;;
  2486.       *) perm_rpath="$perm_rpath $libdir" ;;
  2487.       esac
  2488.     fi
  2489.       done
  2490.       # Substitute the hardcoded libdirs into the rpath.
  2491.       if test -n "$hardcode_libdir_separator" &&
  2492.      test -n "$hardcode_libdirs"; then
  2493.     libdir="$hardcode_libdirs"
  2494.     eval rpath=\" $hardcode_libdir_flag_spec\"
  2495.       fi
  2496.       compile_rpath="$rpath"
  2497.  
  2498.       rpath=
  2499.       hardcode_libdirs=
  2500.       for libdir in $finalize_rpath; do
  2501.     if test -n "$hardcode_libdir_flag_spec"; then
  2502.       if test -n "$hardcode_libdir_separator"; then
  2503.         if test -z "$hardcode_libdirs"; then
  2504.           hardcode_libdirs="$libdir"
  2505.         else
  2506.           # Just accumulate the unique libdirs.
  2507.           case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
  2508.           *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  2509.         ;;
  2510.           *)
  2511.         hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  2512.         ;;
  2513.           esac
  2514.         fi
  2515.       else
  2516.         eval flag=\"$hardcode_libdir_flag_spec\"
  2517.         rpath="$rpath $flag"
  2518.       fi
  2519.     elif test -n "$runpath_var"; then
  2520.       case "$finalize_perm_rpath " in
  2521.       *" $libdir "*) ;;
  2522.       *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
  2523.       esac
  2524.     fi
  2525.       done
  2526.       # Substitute the hardcoded libdirs into the rpath.
  2527.       if test -n "$hardcode_libdir_separator" &&
  2528.      test -n "$hardcode_libdirs"; then
  2529.     libdir="$hardcode_libdirs"
  2530.     eval rpath=\" $hardcode_libdir_flag_spec\"
  2531.       fi
  2532.       finalize_rpath="$rpath"
  2533.  
  2534.       output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
  2535.       if test "X$output_objdir" = "X$output"; then
  2536.     output_objdir="$objdir"
  2537.       else
  2538.     output_objdir="$output_objdir/$objdir"
  2539.       fi
  2540.  
  2541.       # Create the binary in the object directory, then wrap it.
  2542.       if test ! -d $output_objdir; then
  2543.     $show "$mkdir $output_objdir"
  2544.     $run $mkdir $output_objdir
  2545.     status=$?
  2546.     if test $status -ne 0 && test ! -d $output_objdir; then
  2547.       exit $status
  2548.     fi
  2549.       fi
  2550.  
  2551.       if test -n "$libobjs" && test "$build_old_libs" = yes; then
  2552.     # Transform all the library objects into standard objects.
  2553.     compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  2554.     finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  2555.       fi
  2556.  
  2557.       dlsyms=
  2558.       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  2559.     if test -n "$NM" && test -n "$global_symbol_pipe"; then
  2560.       dlsyms="${outputname}S.c"
  2561.     else
  2562.       $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
  2563.     fi
  2564.       fi
  2565.  
  2566.       if test -n "$dlsyms"; then
  2567.     case "$dlsyms" in
  2568.     "") ;;
  2569.     *.c)
  2570.       # Discover the nlist of each of the dlfiles.
  2571.       nlist="$output_objdir/${outputname}.nm"
  2572.  
  2573.       $show "$rm $nlist ${nlist}S ${nlist}T"
  2574.       $run $rm "$nlist" "${nlist}S" "${nlist}T"
  2575.  
  2576.       # Parse the name list into a source file.
  2577.       $show "creating $output_objdir/$dlsyms"
  2578.  
  2579.       test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
  2580. /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
  2581. /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
  2582.  
  2583. #ifdef __cplusplus
  2584. extern \"C\" {
  2585. #endif
  2586.  
  2587. /* Prevent the only kind of declaration conflicts we can make. */
  2588. #define lt_preloaded_symbols some_other_symbol
  2589.  
  2590. /* External symbol declarations for the compiler. */\
  2591. "
  2592.  
  2593.       if test "$dlself" = yes; then
  2594.         $show "generating symbol list for \`$output'"
  2595.  
  2596.         test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
  2597.  
  2598.         # Add our own program objects to the symbol list.
  2599.         progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  2600.         for arg in $progfiles; do
  2601.           $show "extracting global C symbols from \`$arg'"
  2602.           $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
  2603.         done
  2604.  
  2605.         if test -n "$exclude_expsyms"; then
  2606.           $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
  2607.           $run eval '$mv "$nlist"T "$nlist"'
  2608.         fi
  2609.         
  2610.         if test -n "$export_symbols_regex"; then
  2611.           $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
  2612.           $run eval '$mv "$nlist"T "$nlist"'
  2613.         fi
  2614.  
  2615.         # Prepare the list of exported symbols
  2616.         if test -z "$export_symbols"; then
  2617.           export_symbols="$output_objdir/$output.exp"
  2618.           $run $rm $export_symbols
  2619.           $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
  2620.         else
  2621.           $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
  2622.           $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
  2623.           $run eval 'mv "$nlist"T "$nlist"'
  2624.         fi
  2625.       fi
  2626.  
  2627.       for arg in $dlprefiles; do
  2628.         $show "extracting global C symbols from \`$arg'"
  2629.         name=`echo "$arg" | sed -e 's%^.*/%%'`
  2630.         $run eval 'echo ": $name " >> "$nlist"'
  2631.         $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
  2632.       done
  2633.  
  2634.       if test -z "$run"; then
  2635.         # Make sure we have at least an empty file.
  2636.         test -f "$nlist" || : > "$nlist"
  2637.  
  2638.         if test -n "$exclude_expsyms"; then
  2639.           egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
  2640.           $mv "$nlist"T "$nlist"
  2641.         fi
  2642.  
  2643.         # Try sorting and uniquifying the output.
  2644.         if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
  2645.           :
  2646.         else
  2647.           grep -v "^: " < "$nlist" > "$nlist"S
  2648.         fi
  2649.  
  2650.         if test -f "$nlist"S; then
  2651.           eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
  2652.         else
  2653.           echo '/* NONE */' >> "$output_objdir/$dlsyms"
  2654.         fi
  2655.  
  2656.         $echo >> "$output_objdir/$dlsyms" "\
  2657.  
  2658. #undef lt_preloaded_symbols
  2659.  
  2660. #if defined (__STDC__) && __STDC__
  2661. # define lt_ptr_t void *
  2662. #else
  2663. # define lt_ptr_t char *
  2664. # define const
  2665. #endif
  2666.  
  2667. /* The mapping between symbol names and symbols. */
  2668. const struct {
  2669.   const char *name;
  2670.   lt_ptr_t address;
  2671. }
  2672. lt_preloaded_symbols[] =
  2673. {\
  2674. "
  2675.  
  2676.         sed -n -e 's/^: \([^ ]*\) $/  {\"\1\", (lt_ptr_t) 0},/p' \
  2677.         -e 's/^. \([^ ]*\) \([^ ]*\)$/  {"\2", (lt_ptr_t) \&\2},/p' \
  2678.           < "$nlist" >> "$output_objdir/$dlsyms"
  2679.  
  2680.         $echo >> "$output_objdir/$dlsyms" "\
  2681.   {0, (lt_ptr_t) 0}
  2682. };
  2683.  
  2684. /* This works around a problem in FreeBSD linker */
  2685. #ifdef FREEBSD_WORKAROUND
  2686. static const void *lt_preloaded_setup() {
  2687.   return lt_preloaded_symbols;
  2688. }
  2689. #endif
  2690.  
  2691. #ifdef __cplusplus
  2692. }
  2693. #endif\
  2694. "
  2695.       fi
  2696.  
  2697.       pic_flag_for_symtable=
  2698.       case "$host" in
  2699.       # compiling the symbol table file with pic_flag works around
  2700.       # a FreeBSD bug that causes programs to crash when -lm is
  2701.       # linked before any other PIC object.  But we must not use
  2702.       # pic_flag when linking with -static.  The problem exists in
  2703.       # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
  2704.       *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
  2705.         case "$compile_command " in
  2706.         *" -static "*) ;;
  2707.         *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
  2708.         esac;;
  2709.       *-*-hpux*)
  2710.         case "$compile_command " in
  2711.         *" -static "*) ;;
  2712.         *) pic_flag_for_symtable=" $pic_flag -DPIC";;
  2713.         esac
  2714.       esac
  2715.  
  2716.       # Now compile the dynamic symbol file.
  2717.       $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
  2718.       $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
  2719.  
  2720.       # Clean up the generated files.
  2721.       $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
  2722.       $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
  2723.  
  2724.       # Transform the symbol file into the correct name.
  2725.       compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
  2726.       finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
  2727.       ;;
  2728.     *)
  2729.       $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
  2730.       exit 1
  2731.       ;;
  2732.     esac
  2733.       else
  2734.     # We keep going just in case the user didn't refer to
  2735.     # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
  2736.     # really was required.
  2737.  
  2738.     # Nullify the symbol file.
  2739.     compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
  2740.     finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
  2741.       fi
  2742.  
  2743.       if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
  2744.     # Replace the output file specification.
  2745.     compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
  2746.     link_command="$compile_command$compile_rpath"
  2747.  
  2748.     # We have no uninstalled library dependencies, so finalize right now.
  2749.     $show "$link_command"
  2750.     $run eval "$link_command"
  2751.     status=$?
  2752.     
  2753.     # Delete the generated files.
  2754.     if test -n "$dlsyms"; then
  2755.       $show "$rm $output_objdir/${outputname}S.${objext}"
  2756.       $run $rm "$output_objdir/${outputname}S.${objext}"
  2757.     fi
  2758.  
  2759.     exit $status
  2760.       fi
  2761.  
  2762.       if test -n "$shlibpath_var"; then
  2763.     # We should set the shlibpath_var
  2764.     rpath=
  2765.     for dir in $temp_rpath; do
  2766.       case "$dir" in
  2767.       [\\/]* | [A-Za-z]:[\\/]*)
  2768.         # Absolute path.
  2769.         rpath="$rpath$dir:"
  2770.         ;;
  2771.       *)
  2772.         # Relative path: add a thisdir entry.
  2773.         rpath="$rpath\$thisdir/$dir:"
  2774.         ;;
  2775.       esac
  2776.     done
  2777.     temp_rpath="$rpath"
  2778.       fi
  2779.  
  2780.       if test -n "$compile_shlibpath$finalize_shlibpath"; then
  2781.     compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
  2782.       fi
  2783.       if test -n "$finalize_shlibpath"; then
  2784.     finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
  2785.       fi
  2786.  
  2787.       compile_var=
  2788.       finalize_var=
  2789.       if test -n "$runpath_var"; then
  2790.     if test -n "$perm_rpath"; then
  2791.       # We should set the runpath_var.
  2792.       rpath=
  2793.       for dir in $perm_rpath; do
  2794.         rpath="$rpath$dir:"
  2795.       done
  2796.       compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
  2797.     fi
  2798.     if test -n "$finalize_perm_rpath"; then
  2799.       # We should set the runpath_var.
  2800.       rpath=
  2801.       for dir in $finalize_perm_rpath; do
  2802.         rpath="$rpath$dir:"
  2803.       done
  2804.       finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
  2805.     fi
  2806.       fi
  2807.  
  2808.       if test "$hardcode_action" = relink; then
  2809.     # Fast installation is not supported
  2810.     link_command="$compile_var$compile_command$compile_rpath"
  2811.     relink_command="$finalize_var$finalize_command$finalize_rpath"
  2812.     
  2813.     $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
  2814.     $echo "$modename: \`$output' will be relinked during installation" 1>&2
  2815.       else
  2816.     if test "$fast_install" != no; then
  2817.       link_command="$finalize_var$compile_command$finalize_rpath"
  2818.       if test "$fast_install" = yes; then
  2819.         relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
  2820.       else
  2821.         # fast_install is set to needless
  2822.         relink_command=
  2823.       fi
  2824.     else
  2825.       link_command="$compile_var$compile_command$compile_rpath"
  2826.       relink_command="$finalize_var$finalize_command$finalize_rpath"
  2827.     fi
  2828.       fi
  2829.  
  2830.       # Replace the output file specification.
  2831.       link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
  2832.       
  2833.       # Delete the old output files.
  2834.       $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
  2835.  
  2836.       $show "$link_command"
  2837.       $run eval "$link_command" || exit $?
  2838.  
  2839.       # Now create the wrapper script.
  2840.       $show "creating $output"
  2841.  
  2842.       # Quote the relink command for shipping.
  2843.       if test -n "$relink_command"; then
  2844.     relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
  2845.       fi
  2846.  
  2847.       # Quote $echo for shipping.
  2848.       if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
  2849.     case "$0" in
  2850.     [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
  2851.     *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
  2852.     esac
  2853.     qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
  2854.       else
  2855.     qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
  2856.       fi
  2857.  
  2858.       # Only actually do things if our run command is non-null.
  2859.       if test -z "$run"; then
  2860.     # win32 will think the script is a binary if it has
  2861.     # a .exe suffix, so we strip it off here.
  2862.     case $output in
  2863.       *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
  2864.     esac
  2865.     $rm $output
  2866.     trap "$rm $output; exit 1" 1 2 15
  2867.  
  2868.     $echo > $output "\
  2869. #! $SHELL
  2870.  
  2871. # $output - temporary wrapper script for $objdir/$outputname
  2872. # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
  2873. #
  2874. # The $output program cannot be directly executed until all the libtool
  2875. # libraries that it depends on are installed.
  2876. #
  2877. # This wrapper script should never be moved out of the build directory.
  2878. # If it is, it will not operate correctly.
  2879.  
  2880. # Sed substitution that helps us do robust quoting.  It backslashifies
  2881. # metacharacters that are still active within double-quoted strings.
  2882. Xsed='sed -e 1s/^X//'
  2883. sed_quote_subst='$sed_quote_subst'
  2884.  
  2885. # The HP-UX ksh and POSIX shell print the target directory to stdout
  2886. # if CDPATH is set.
  2887. if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
  2888.  
  2889. relink_command=\"$relink_command\"
  2890.  
  2891. # This environment variable determines our operation mode.
  2892. if test \"\$libtool_install_magic\" = \"$magic\"; then
  2893.   # install mode needs the following variable:
  2894.   link_against_libtool_libs='$link_against_libtool_libs'
  2895. else
  2896.   # When we are sourced in execute mode, \$file and \$echo are already set.
  2897.   if test \"\$libtool_execute_magic\" != \"$magic\"; then
  2898.     echo=\"$qecho\"
  2899.     file=\"\$0\"
  2900.     # Make sure echo works.
  2901.     if test \"X\$1\" = X--no-reexec; then
  2902.       # Discard the --no-reexec flag, and continue.
  2903.       shift
  2904.     elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
  2905.       # Yippee, \$echo works!
  2906.       :
  2907.     else
  2908.       # Restart under the correct shell, and then maybe \$echo will work.
  2909.       exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
  2910.     fi
  2911.   fi\
  2912. "
  2913.     $echo >> $output "\
  2914.  
  2915.   # Find the directory that this script lives in.
  2916.   thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
  2917.   test \"x\$thisdir\" = \"x\$file\" && thisdir=.
  2918.  
  2919.   # Follow symbolic links until we get to the real thisdir.
  2920.   file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
  2921.   while test -n \"\$file\"; do
  2922.     destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
  2923.  
  2924.     # If there was a directory component, then change thisdir.
  2925.     if test \"x\$destdir\" != \"x\$file\"; then
  2926.       case \"\$destdir\" in
  2927.       [\\/]* | [A-Za-z]:[\\/]*) thisdir=\"\$destdir\" ;;
  2928.       *) thisdir=\"\$thisdir/\$destdir\" ;;
  2929.       esac
  2930.     fi
  2931.  
  2932.     file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
  2933.     file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
  2934.   done
  2935.  
  2936.   # Try to get the absolute directory name.
  2937.   absdir=\`cd \"\$thisdir\" && pwd\`
  2938.   test -n \"\$absdir\" && thisdir=\"\$absdir\"
  2939. "
  2940.  
  2941.     if test "$fast_install" = yes; then
  2942.       echo >> $output "\
  2943.   program=lt-'$outputname'
  2944.   progdir=\"\$thisdir/$objdir\"
  2945.   
  2946.   if test ! -f \"\$progdir/\$program\" || \\
  2947.      { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
  2948.        test \"X\$file\" != \"X\$progdir/\$program\"; }; then
  2949.  
  2950.     file=\"\$\$-\$program\"
  2951.  
  2952.     if test ! -d \"\$progdir\"; then
  2953.       $mkdir \"\$progdir\"
  2954.     else
  2955.       $rm \"\$progdir/\$file\"
  2956.     fi"
  2957.  
  2958.       echo >> $output "\
  2959.  
  2960.     # relink executable if necessary
  2961.     if test -n \"\$relink_command\"; then
  2962.       if (cd \"\$thisdir\" && eval \$relink_command); then :
  2963.       else
  2964.     $rm \"\$progdir/\$file\"
  2965.     exit 1
  2966.       fi
  2967.     fi
  2968.  
  2969.     $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
  2970.     { $rm \"\$progdir/\$program\";
  2971.       $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
  2972.     $rm \"\$progdir/\$file\"
  2973.   fi"
  2974.     else
  2975.       echo >> $output "\
  2976.   program='$outputname'
  2977.   progdir=\"\$thisdir/$objdir\"
  2978. "
  2979.     fi
  2980.  
  2981.     echo >> $output "\
  2982.  
  2983.   if test -f \"\$progdir/\$program\"; then"
  2984.  
  2985.     # Export our shlibpath_var if we have one.
  2986.     if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
  2987.       $echo >> $output "\
  2988.     # Add our own library path to $shlibpath_var
  2989.     $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
  2990.  
  2991.     # Some systems cannot cope with colon-terminated $shlibpath_var
  2992.     # The second colon is a workaround for a bug in BeOS R4 sed
  2993.     $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
  2994.  
  2995.     export $shlibpath_var
  2996. "
  2997.     fi
  2998.  
  2999.     # fixup the dll searchpath if we need to.
  3000.     if test -n "$dllsearchpath"; then
  3001.       $echo >> $output "\
  3002.     # Add the dll search path components to the executable PATH
  3003.     PATH=$dllsearchpath:\$PATH
  3004. "
  3005.     fi
  3006.  
  3007.     $echo >> $output "\
  3008.     if test \"\$libtool_execute_magic\" != \"$magic\"; then
  3009.       # Run the actual program with our arguments.
  3010. "
  3011.     case $host in
  3012.     *-*-cygwin* | *-*-mingw | *-*-os2*)
  3013.       # win32 systems need to use the prog path for dll
  3014.       # lookup to work
  3015.       $echo >> $output "\
  3016.       exec \$progdir\\\\\$program \${1+\"\$@\"}
  3017. "
  3018.       ;;
  3019.     *)
  3020.       $echo >> $output "\
  3021.       # Export the path to the program.
  3022.       PATH=\"\$progdir:\$PATH\"
  3023.       export PATH
  3024.  
  3025.       exec \$program \${1+\"\$@\"}
  3026. "
  3027.       ;;
  3028.     esac
  3029.     $echo >> $output "\
  3030.       \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
  3031.       exit 1
  3032.     fi
  3033.   else
  3034.     # The program doesn't exist.
  3035.     \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
  3036.     \$echo \"This script is just a wrapper for \$program.\" 1>&2
  3037.     echo \"See the $PACKAGE documentation for more information.\" 1>&2
  3038.     exit 1
  3039.   fi
  3040. fi\
  3041. "
  3042.     chmod +x $output
  3043.       fi
  3044.       exit 0
  3045.       ;;
  3046.     esac
  3047.  
  3048.     # See if we need to build an old-fashioned archive.
  3049.     for oldlib in $oldlibs; do
  3050.  
  3051.       if test "$build_libtool_libs" = convenience; then
  3052.     oldobjs="$libobjs_save"
  3053.     addlibs="$convenience"
  3054.     build_libtool_libs=no
  3055.       else
  3056.     if test "$build_libtool_libs" = module; then
  3057.       oldobjs="$libobjs_save"
  3058.       build_libtool_libs=no
  3059.     else
  3060.       oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
  3061.     fi
  3062.     addlibs="$old_convenience"
  3063.       fi
  3064.  
  3065.       if test -n "$addlibs"; then
  3066.     gentop="$output_objdir/${outputname}x"
  3067.     $show "${rm}r $gentop"
  3068.     $run ${rm}r "$gentop"
  3069.     $show "mkdir $gentop"
  3070.     $run mkdir "$gentop"
  3071.     status=$?
  3072.     if test $status -ne 0 && test ! -d "$gentop"; then
  3073.       exit $status
  3074.     fi
  3075.     generated="$generated $gentop"
  3076.       
  3077.     # Add in members from convenience archives.
  3078.     for xlib in $addlibs; do
  3079.       # Extract the objects.
  3080.       case "$xlib" in
  3081.       [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
  3082.       *) xabs=`pwd`"/$xlib" ;;
  3083.       esac
  3084.       xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
  3085.       xdir="$gentop/$xlib"
  3086.  
  3087.       $show "${rm}r $xdir"
  3088.       $run ${rm}r "$xdir"
  3089.       $show "mkdir $xdir"
  3090.       $run mkdir "$xdir"
  3091.       status=$?
  3092.       if test $status -ne 0 && test ! -d "$xdir"; then
  3093.         exit $status
  3094.       fi
  3095.       $show "(cd $xdir && $AR x $xabs)"
  3096.       $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
  3097.  
  3098.       oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
  3099.     done
  3100.       fi
  3101.  
  3102.       # Do each command in the archive commands.
  3103.       if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
  3104.     eval cmds=\"$old_archive_from_new_cmds\"
  3105.       else
  3106.     # Ensure that we have .o objects in place in case we decided
  3107.     # not to build a shared library, and have fallen back to building
  3108.     # static libs even though --disable-static was passed!
  3109.     for oldobj in $oldobjs; do
  3110.       if test ! -f $oldobj; then
  3111.         xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
  3112.         if test "X$xdir" = "X$oldobj"; then
  3113.           xdir="."
  3114.         else
  3115.           xdir="$xdir"
  3116.         fi
  3117.         baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
  3118.         obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
  3119.         $show "(cd $xdir && ${LN_S} $obj $baseobj)"
  3120.         $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
  3121.       fi
  3122.     done
  3123.  
  3124.     eval cmds=\"$old_archive_cmds\"
  3125.       fi
  3126.       IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
  3127.       for cmd in $cmds; do
  3128.     IFS="$save_ifs"
  3129.     $show "$cmd"
  3130.     $run eval "$cmd" || exit $?
  3131.       done
  3132.       IFS="$save_ifs"
  3133.     done
  3134.  
  3135.     if test -n "$generated"; then
  3136.       $show "${rm}r$generated"
  3137.       $run ${rm}r$generated
  3138.     fi
  3139.  
  3140.     # Now create the libtool archive.
  3141.     case "$output" in
  3142.     *.la)
  3143.       old_library=
  3144.       if test "$release_suffix" = all; then
  3145.         test "$build_old_libs" = yes && old_library="$libname$release.$libext"
  3146.       else
  3147.         test "$build_old_libs" = yes && old_library="$libname.$libext"
  3148.       fi
  3149.       $show "creating $output"
  3150.  
  3151.       if test -n "$xrpath"; then
  3152.     temp_xrpath=
  3153.     for libdir in $xrpath; do
  3154.       temp_xrpath="$temp_xrpath -R$libdir"
  3155.     done
  3156.     dependency_libs="$temp_xrpath $dependency_libs"
  3157.       fi
  3158.  
  3159.       # Only create the output if not a dry run.
  3160.       if test -z "$run"; then
  3161.     for installed in no yes; do
  3162.       if test "$installed" = yes; then
  3163.         if test -z "$install_libdir"; then
  3164.           break
  3165.         fi
  3166.         output="$output_objdir/$outputname"i
  3167.       fi
  3168.       $rm $output
  3169.       $echo > $output "\
  3170. # $outputname - a libtool library file
  3171. # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
  3172. #
  3173. # Please DO NOT delete this file!
  3174. # It is necessary for linking the library.
  3175.  
  3176. # The name that we can dlopen(3).
  3177. dlname='$dlname'
  3178.  
  3179. # Names of this library.
  3180. library_names='$library_names'
  3181.  
  3182. # The name of the static archive.
  3183. old_library='$old_library'
  3184.  
  3185. # Libraries that this one depends upon.
  3186. dependency_libs='$dependency_libs'
  3187.  
  3188. # Version information for $libname.
  3189. current=$current
  3190. age=$age
  3191. revision=$revision
  3192.  
  3193. # Is this an already installed library?
  3194. installed=$installed
  3195.  
  3196. # Directory that this library needs to be installed in:
  3197. libdir='$install_libdir'\
  3198. "
  3199.     done
  3200.       fi
  3201.  
  3202.       # Do a symbolic link so that the libtool archive can be found in
  3203.       # LD_LIBRARY_PATH before the program is installed.
  3204.       $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
  3205.       $run eval "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" || exit $?
  3206.       ;;
  3207.     esac
  3208.     exit 0
  3209.     ;;
  3210.  
  3211.   # libtool install mode
  3212.   install)
  3213.     modename="$modename: install"
  3214.  
  3215.     # There may be an optional sh(1) argument at the beginning of
  3216.     # install_prog (especially on Windows NT).
  3217.     if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh; then
  3218.       # Aesthetically quote it.
  3219.       arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
  3220.       case "$arg" in
  3221.       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*)
  3222.     arg="\"$arg\""
  3223.     ;;
  3224.       esac
  3225.       install_prog="$arg "
  3226.       arg="$1"
  3227.       shift
  3228.     else
  3229.       install_prog=
  3230.       arg="$nonopt"
  3231.     fi
  3232.  
  3233.     # The real first argument should be the name of the installation program.
  3234.     # Aesthetically quote it.
  3235.     arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  3236.     case "$arg" in
  3237.     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*)
  3238.       arg="\"$arg\""
  3239.       ;;
  3240.     esac
  3241.     install_prog="$install_prog$arg"
  3242.  
  3243.     # We need to accept at least all the BSD install flags.
  3244.     dest=
  3245.     files=
  3246.     opts=
  3247.     prev=
  3248.     install_type=
  3249.     isdir=no
  3250.     stripme=
  3251.     for arg
  3252.     do
  3253.       if test -n "$dest"; then
  3254.     files="$files $dest"
  3255.     dest="$arg"
  3256.     continue
  3257.       fi
  3258.  
  3259.       case "$arg" in
  3260.       -d) isdir=yes ;;
  3261.       -f) prev="-f" ;;
  3262.       -g) prev="-g" ;;
  3263.       -m) prev="-m" ;;
  3264.       -o) prev="-o" ;;
  3265.       -s)
  3266.     stripme=" -s"
  3267.     continue
  3268.     ;;
  3269.       -*) ;;
  3270.  
  3271.       *)
  3272.     # If the previous option needed an argument, then skip it.
  3273.     if test -n "$prev"; then
  3274.       prev=
  3275.     else
  3276.       dest="$arg"
  3277.       continue
  3278.     fi
  3279.     ;;
  3280.       esac
  3281.  
  3282.       # Aesthetically quote the argument.
  3283.       arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  3284.       case "$arg" in
  3285.       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*)
  3286.     arg="\"$arg\""
  3287.     ;;
  3288.       esac
  3289.       install_prog="$install_prog $arg"
  3290.     done
  3291.  
  3292.     if test -z "$install_prog"; then
  3293.       $echo "$modename: you must specify an install program" 1>&2
  3294.       $echo "$help" 1>&2
  3295.       exit 1
  3296.     fi
  3297.  
  3298.     if test -n "$prev"; then
  3299.       $echo "$modename: the \`$prev' option requires an argument" 1>&2
  3300.       $echo "$help" 1>&2
  3301.       exit 1
  3302.     fi
  3303.  
  3304.     if test -z "$files"; then
  3305.       if test -z "$dest"; then
  3306.     $echo "$modename: no file or destination specified" 1>&2
  3307.       else
  3308.     $echo "$modename: you must specify a destination" 1>&2
  3309.       fi
  3310.       $echo "$help" 1>&2
  3311.       exit 1
  3312.     fi
  3313.  
  3314.     # Strip any trailing slash from the destination.
  3315.     dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
  3316.  
  3317.     # Check to see that the destination is a directory.
  3318.     test -d "$dest" && isdir=yes
  3319.     if test "$isdir" = yes; then
  3320.       destdir="$dest"
  3321.       destname=
  3322.     else
  3323.       destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
  3324.       test "X$destdir" = "X$dest" && destdir=.
  3325.       destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
  3326.  
  3327.       # Not a directory, so check to see that there is only one file specified.
  3328.       set dummy $files
  3329.       if test $# -gt 2; then
  3330.     $echo "$modename: \`$dest' is not a directory" 1>&2
  3331.     $echo "$help" 1>&2
  3332.     exit 1
  3333.       fi
  3334.     fi
  3335.     case "$destdir" in
  3336.     [\\/]* | [A-Za-z]:[\\/]*) ;;
  3337.     *)
  3338.       for file in $files; do
  3339.     case "$file" in
  3340.     *.lo) ;;
  3341.     *)
  3342.       $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
  3343.       $echo "$help" 1>&2
  3344.       exit 1
  3345.       ;;
  3346.     esac
  3347.       done
  3348.       ;;
  3349.     esac
  3350.  
  3351.     # This variable tells wrapper scripts just to set variables rather
  3352.     # than running their programs.
  3353.     libtool_install_magic="$magic"
  3354.  
  3355.     staticlibs=
  3356.     future_libdirs=
  3357.     current_libdirs=
  3358.     for file in $files; do
  3359.  
  3360.       # Do each installation.
  3361.       case "$file" in
  3362.       *.a | *.lib)
  3363.     # Do the static libraries later.
  3364.     staticlibs="$staticlibs $file"
  3365.     ;;
  3366.  
  3367.       *.la)
  3368.     # Check to see that this really is a libtool archive.
  3369.     if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  3370.     else
  3371.       $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
  3372.       $echo "$help" 1>&2
  3373.       exit 1
  3374.     fi
  3375.  
  3376.     library_names=
  3377.     old_library=
  3378.     # If there is no directory component, then add one.
  3379.     case "$file" in
  3380.     */* | *\\*) . $file ;;
  3381.     *) . ./$file ;;
  3382.     esac
  3383.  
  3384.     # Add the libdir to current_libdirs if it is the destination.
  3385.     if test "X$destdir" = "X$libdir"; then
  3386.       case "$current_libdirs " in
  3387.       *" $libdir "*) ;;
  3388.       *) current_libdirs="$current_libdirs $libdir" ;;
  3389.       esac
  3390.     else
  3391.       # Note the libdir as a future libdir.
  3392.       case "$future_libdirs " in
  3393.       *" $libdir "*) ;;
  3394.       *) future_libdirs="$future_libdirs $libdir" ;;
  3395.       esac
  3396.     fi
  3397.  
  3398.     dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/"
  3399.     test "X$dir" = "X$file/" && dir=
  3400.     dir="$dir$objdir"
  3401.  
  3402.     # See the names of the shared library.
  3403.     set dummy $library_names
  3404.     if test -n "$2"; then
  3405.       realname="$2"
  3406.       shift
  3407.       shift
  3408.  
  3409.       # Install the shared library and build the symlinks.
  3410.       $show "$install_prog $dir/$realname $destdir/$realname"
  3411.       $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
  3412.  
  3413.       if test $# -gt 0; then
  3414.         # Delete the old symlinks, and create new ones.
  3415.         for linkname
  3416.         do
  3417.           if test "$linkname" != "$realname"; then
  3418.         $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
  3419.         $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
  3420.           fi
  3421.         done
  3422.       fi
  3423.  
  3424.       # Do each command in the postinstall commands.
  3425.       lib="$destdir/$realname"
  3426.       eval cmds=\"$postinstall_cmds\"
  3427.       IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
  3428.       for cmd in $cmds; do
  3429.         IFS="$save_ifs"
  3430.         $show "$cmd"
  3431.         $run eval "$cmd" || exit $?
  3432.       done
  3433.       IFS="$save_ifs"
  3434.     fi
  3435.  
  3436.     # Install the pseudo-library for information purposes.
  3437.     if test "$install_ltlibs" = yes; then
  3438.       name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  3439.       instname="$dir/$name"i
  3440.       $show "$install_prog $instname $destdir/$name"
  3441.       $run eval "$install_prog $instname $destdir/$name" || exit $?
  3442.     fi
  3443.  
  3444.     # Maybe install the static library, too.
  3445.     test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
  3446.     ;;
  3447.  
  3448.       *.lo)
  3449.     # Install (i.e. copy) a libtool object.
  3450.  
  3451.     # Figure out destination file name, if it wasn't already specified.
  3452.     if test -n "$destname"; then
  3453.       destfile="$destdir/$destname"
  3454.     else
  3455.       destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  3456.       destfile="$destdir/$destfile"
  3457.     fi
  3458.  
  3459.     # Deduce the name of the destination old-style object file.
  3460.     case "$destfile" in
  3461.     *.lo)
  3462.       staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
  3463.       ;;
  3464.     *.o | *.obj)
  3465.       staticdest="$destfile"
  3466.       destfile=
  3467.       ;;
  3468.     *)
  3469.       $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
  3470.       $echo "$help" 1>&2
  3471.       exit 1
  3472.       ;;
  3473.     esac
  3474.  
  3475.     # Install the libtool object if requested.
  3476.     if test -n "$destfile"; then
  3477.       $show "$install_prog $file $destfile"
  3478.       $run eval "$install_prog $file $destfile" || exit $?
  3479.     fi
  3480.  
  3481.     # Install the old object if enabled.
  3482.     if test "$build_old_libs" = yes; then
  3483.       # Deduce the name of the old-style object file.
  3484.       staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
  3485.  
  3486.       $show "$install_prog $staticobj $staticdest"
  3487.       $run eval "$install_prog \$staticobj \$staticdest" || exit $?
  3488.     fi
  3489.     exit 0
  3490.     ;;
  3491.  
  3492.       *)
  3493.     # Figure out destination file name, if it wasn't already specified.
  3494.     if test -n "$destname"; then
  3495.       destfile="$destdir/$destname"
  3496.     else
  3497.       destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  3498.       destfile="$destdir/$destfile"
  3499.     fi
  3500.  
  3501.     # Do a test to see if this is really a libtool program.
  3502.     if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  3503.       link_against_libtool_libs=
  3504.       relink_command=
  3505.  
  3506.       # If there is no directory component, then add one.
  3507.       case "$file" in
  3508.       */* | *\\*) . $file ;;
  3509.       *) . ./$file ;;
  3510.       esac
  3511.  
  3512.       # Check the variables that should have been set.
  3513.       if test -z "$link_against_libtool_libs"; then
  3514.         $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
  3515.         exit 1
  3516.       fi
  3517.  
  3518.       finalize=yes
  3519.       for lib in $link_against_libtool_libs; do
  3520.         # Check to see that each library is installed.
  3521.         libdir=
  3522.         if test -f "$lib"; then
  3523.           # If there is no directory component, then add one.
  3524.           case "$lib" in
  3525.           */* | *\\*) . $lib ;;
  3526.           *) . ./$lib ;;
  3527.           esac
  3528.         fi
  3529.         libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`"
  3530.         if test -n "$libdir" && test ! -f "$libfile"; then
  3531.           finalize=no
  3532.         fi
  3533.       done
  3534.  
  3535.       outputname=
  3536.       if test "$fast_install" = no && test -n "$relink_command"; then
  3537.         if test "$finalize" = yes && test -z "$run"; then
  3538.           tmpdir="/tmp"
  3539.           test -n "$TMPDIR" && tmpdir="$TMPDIR"
  3540.           tmpdir="$tmpdir/libtool-$$"
  3541.           if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
  3542.           else
  3543.         $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
  3544.         continue
  3545.           fi
  3546.           outputname="$tmpdir/$file"
  3547.           # Replace the output file specification.
  3548.           relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
  3549.  
  3550.           $show "$relink_command"
  3551.           if $run eval "$relink_command"; then :
  3552.           else
  3553.         $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
  3554.         ${rm}r "$tmpdir"
  3555.         continue
  3556.           fi
  3557.           file="$outputname"
  3558.         else
  3559.           $echo "$modename: warning: cannot relink \`$file'" 1>&2
  3560.         fi
  3561.       else
  3562.         # Install the binary that we compiled earlier.
  3563.         file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
  3564.       fi
  3565.     fi
  3566.  
  3567.     $show "$install_prog$stripme $file $destfile"
  3568.     $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
  3569.     test -n "$outputname" && ${rm}r "$tmpdir"
  3570.     ;;
  3571.       esac
  3572.     done
  3573.  
  3574.     for file in $staticlibs; do
  3575.       name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  3576.  
  3577.       # Set up the ranlib parameters.
  3578.       oldlib="$destdir/$name"
  3579.  
  3580.       $show "$install_prog $file $oldlib"
  3581.       $run eval "$install_prog \$file \$oldlib" || exit $?
  3582.  
  3583.       # Do each command in the postinstall commands.
  3584.       eval cmds=\"$old_postinstall_cmds\"
  3585.       IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
  3586.       for cmd in $cmds; do
  3587.     IFS="$save_ifs"
  3588.     $show "$cmd"
  3589.     $run eval "$cmd" || exit $?
  3590.       done
  3591.       IFS="$save_ifs"
  3592.     done
  3593.  
  3594.     if test -n "$future_libdirs"; then
  3595.       $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
  3596.     fi
  3597.  
  3598.     if test -n "$current_libdirs"; then
  3599.       # Maybe just do a dry run.
  3600.       test -n "$run" && current_libdirs=" -n$current_libdirs"
  3601.       exec $SHELL $0 --finish$current_libdirs
  3602.       exit 1
  3603.     fi
  3604.  
  3605.     exit 0
  3606.     ;;
  3607.  
  3608.   # libtool finish mode
  3609.   finish)
  3610.     modename="$modename: finish"
  3611.     libdirs="$nonopt"
  3612.     admincmds=
  3613.  
  3614.     if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
  3615.       for dir
  3616.       do
  3617.     libdirs="$libdirs $dir"
  3618.       done
  3619.  
  3620.       for libdir in $libdirs; do
  3621.     if test -n "$finish_cmds"; then
  3622.       # Do each command in the finish commands.
  3623.       eval cmds=\"$finish_cmds\"
  3624.       IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
  3625.       for cmd in $cmds; do
  3626.         IFS="$save_ifs"
  3627.         $show "$cmd"
  3628.         $run eval "$cmd" || admincmds="$admincmds
  3629.        $cmd"
  3630.       done
  3631.       IFS="$save_ifs"
  3632.     fi
  3633.     if test -n "$finish_eval"; then
  3634.       # Do the single finish_eval.
  3635.       eval cmds=\"$finish_eval\"
  3636.       $run eval "$cmds" || admincmds="$admincmds
  3637.        $cmds"
  3638.     fi
  3639.       done
  3640.     fi
  3641.  
  3642.     # Exit here if they wanted silent mode.
  3643.     test "$show" = : && exit 0
  3644.  
  3645.     echo "----------------------------------------------------------------------"
  3646.     echo "Libraries have been installed in:"
  3647.     for libdir in $libdirs; do
  3648.       echo "   $libdir"
  3649.     done
  3650.     echo
  3651.     echo "If you ever happen to want to link against installed libraries"
  3652.     echo "in a given directory, LIBDIR, you must either use libtool, and"
  3653.     echo "specify the full pathname of the library, or use \`-LLIBDIR'"
  3654.     echo "flag during linking and do at least one of the following:"
  3655.     if test -n "$shlibpath_var"; then
  3656.       echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
  3657.       echo "     during execution"
  3658.     fi
  3659.     if test -n "$runpath_var"; then
  3660.       echo "   - add LIBDIR to the \`$runpath_var' environment variable"
  3661.       echo "     during linking"
  3662.     fi
  3663.     if test -n "$hardcode_libdir_flag_spec"; then
  3664.       libdir=LIBDIR
  3665.       eval flag=\"$hardcode_libdir_flag_spec\"
  3666.  
  3667.       echo "   - use the \`$flag' linker flag"
  3668.     fi
  3669.     if test -n "$admincmds"; then
  3670.       echo "   - have your system administrator run these commands:$admincmds"
  3671.     fi
  3672.     if test -f /etc/ld.so.conf; then
  3673.       echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
  3674.     fi
  3675.     echo
  3676.     echo "See any operating system documentation about shared libraries for"
  3677.     echo "more information, such as the ld(1) and ld.so(8) manual pages."
  3678.     echo "----------------------------------------------------------------------"
  3679.     exit 0
  3680.     ;;
  3681.  
  3682.   # libtool execute mode
  3683.   execute)
  3684.     modename="$modename: execute"
  3685.  
  3686.     # The first argument is the command name.
  3687.     cmd="$nonopt"
  3688.     if test -z "$cmd"; then
  3689.       $echo "$modename: you must specify a COMMAND" 1>&2
  3690.       $echo "$help"
  3691.       exit 1
  3692.     fi
  3693.  
  3694.     # Handle -dlopen flags immediately.
  3695.     for file in $execute_dlfiles; do
  3696.       if test ! -f "$file"; then
  3697.     $echo "$modename: \`$file' is not a file" 1>&2
  3698.     $echo "$help" 1>&2
  3699.     exit 1
  3700.       fi
  3701.  
  3702.       dir=
  3703.       case "$file" in
  3704.       *.la)
  3705.     # Check to see that this really is a libtool archive.
  3706.     if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  3707.     else
  3708.       $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  3709.       $echo "$help" 1>&2
  3710.       exit 1
  3711.     fi
  3712.  
  3713.     # Read the libtool library.
  3714.     dlname=
  3715.     library_names=
  3716.  
  3717.     # If there is no directory component, then add one.
  3718.     case "$file" in
  3719.     */* | *\\*) . $file ;;
  3720.     *) . ./$file ;;
  3721.     esac
  3722.  
  3723.     # Skip this library if it cannot be dlopened.
  3724.     if test -z "$dlname"; then
  3725.       # Warn if it was a shared library.
  3726.       test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
  3727.       continue
  3728.     fi
  3729.  
  3730.     dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  3731.     test "X$dir" = "X$file" && dir=.
  3732.  
  3733.     if test -f "$dir/$objdir/$dlname"; then
  3734.       dir="$dir/$objdir"
  3735.     else
  3736.       $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
  3737.       exit 1
  3738.     fi
  3739.     ;;
  3740.  
  3741.       *.lo)
  3742.     # Just add the directory containing the .lo file.
  3743.     dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  3744.     test "X$dir" = "X$file" && dir=.
  3745.     ;;
  3746.  
  3747.       *)
  3748.     $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
  3749.     continue
  3750.     ;;
  3751.       esac
  3752.  
  3753.       # Get the absolute pathname.
  3754.       absdir=`cd "$dir" && pwd`
  3755.       test -n "$absdir" && dir="$absdir"
  3756.  
  3757.       # Now add the directory to shlibpath_var.
  3758.       if eval "test -z \"\$$shlibpath_var\""; then
  3759.     eval "$shlibpath_var=\"\$dir\""
  3760.       else
  3761.     eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
  3762.       fi
  3763.     done
  3764.  
  3765.     # This variable tells wrapper scripts just to set shlibpath_var
  3766.     # rather than running their programs.
  3767.     libtool_execute_magic="$magic"
  3768.  
  3769.     # Check if any of the arguments is a wrapper script.
  3770.     args=
  3771.     for file
  3772.     do
  3773.       case "$file" in
  3774.       -*) ;;
  3775.       *)
  3776.     # Do a test to see if this is really a libtool program.
  3777.     if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  3778.       # If there is no directory component, then add one.
  3779.       case "$file" in
  3780.       */* | *\\*) . $file ;;
  3781.       *) . ./$file ;;
  3782.       esac
  3783.  
  3784.       # Transform arg to wrapped name.
  3785.       file="$progdir/$program"
  3786.     fi
  3787.     ;;
  3788.       esac
  3789.       # Quote arguments (to preserve shell metacharacters).
  3790.       file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
  3791.       args="$args \"$file\""
  3792.     done
  3793.  
  3794.     if test -z "$run"; then
  3795.       if test -n "$shlibpath_var"; then
  3796.         # Export the shlibpath_var.
  3797.         eval "export $shlibpath_var"
  3798.       fi
  3799.  
  3800.       # Restore saved enviroment variables
  3801.       if test "${save_LC_ALL+set}" = set; then
  3802.     LC_ALL="$save_LC_ALL"; export LC_ALL
  3803.       fi
  3804.       if test "${save_LANG+set}" = set; then
  3805.     LANG="$save_LANG"; export LANG
  3806.       fi
  3807.  
  3808.       # Now actually exec the command.
  3809.       eval "exec \$cmd$args"
  3810.  
  3811.       $echo "$modename: cannot exec \$cmd$args"
  3812.       exit 1
  3813.     else
  3814.       # Display what would be done.
  3815.       if test -n "$shlibpath_var"; then
  3816.         eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
  3817.         $echo "export $shlibpath_var"
  3818.       fi
  3819.       $echo "$cmd$args"
  3820.       exit 0
  3821.     fi
  3822.     ;;
  3823.  
  3824.   # libtool uninstall mode
  3825.   uninstall)
  3826.     modename="$modename: uninstall"
  3827.     rm="$nonopt"
  3828.     files=
  3829.  
  3830.     for arg
  3831.     do
  3832.       case "$arg" in
  3833.       -*) rm="$rm $arg" ;;
  3834.       *) files="$files $arg" ;;
  3835.       esac
  3836.     done
  3837.  
  3838.     if test -z "$rm"; then
  3839.       $echo "$modename: you must specify an RM program" 1>&2
  3840.       $echo "$help" 1>&2
  3841.       exit 1
  3842.     fi
  3843.  
  3844.     for file in $files; do
  3845.       dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  3846.       test "X$dir" = "X$file" && dir=.
  3847.       name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  3848.  
  3849.       rmfiles="$file"
  3850.  
  3851.       case "$name" in
  3852.       *.la)
  3853.     # Possibly a libtool archive, so verify it.
  3854.     if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  3855.       . $dir/$name
  3856.  
  3857.       # Delete the libtool libraries and symlinks.
  3858.       for n in $library_names; do
  3859.         rmfiles="$rmfiles $dir/$n"
  3860.       done
  3861.       test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
  3862.  
  3863.       $show "$rm $rmfiles"
  3864.       $run $rm $rmfiles
  3865.  
  3866.       if test -n "$library_names"; then
  3867.         # Do each command in the postuninstall commands.
  3868.         eval cmds=\"$postuninstall_cmds\"
  3869.         IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
  3870.         for cmd in $cmds; do
  3871.           IFS="$save_ifs"
  3872.           $show "$cmd"
  3873.           $run eval "$cmd"
  3874.         done
  3875.         IFS="$save_ifs"
  3876.       fi
  3877.  
  3878.       if test -n "$old_library"; then
  3879.         # Do each command in the old_postuninstall commands.
  3880.         eval cmds=\"$old_postuninstall_cmds\"
  3881.         IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
  3882.         for cmd in $cmds; do
  3883.           IFS="$save_ifs"
  3884.           $show "$cmd"
  3885.           $run eval "$cmd"
  3886.         done
  3887.         IFS="$save_ifs"
  3888.       fi
  3889.  
  3890.       # FIXME: should reinstall the best remaining shared library.
  3891.     fi
  3892.     ;;
  3893.  
  3894.       *.lo)
  3895.     if test "$build_old_libs" = yes; then
  3896.       oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
  3897.       rmfiles="$rmfiles $dir/$oldobj"
  3898.     fi
  3899.     $show "$rm $rmfiles"
  3900.     $run $rm $rmfiles
  3901.     ;;
  3902.  
  3903.       *)
  3904.     $show "$rm $rmfiles"
  3905.     $run $rm $rmfiles
  3906.     ;;
  3907.       esac
  3908.     done
  3909.     exit 0
  3910.     ;;
  3911.  
  3912.   "")
  3913.     $echo "$modename: you must specify a MODE" 1>&2
  3914.     $echo "$generic_help" 1>&2
  3915.     exit 1
  3916.     ;;
  3917.   esac
  3918.  
  3919.   $echo "$modename: invalid operation mode \`$mode'" 1>&2
  3920.   $echo "$generic_help" 1>&2
  3921.   exit 1
  3922. fi # test -z "$show_help"
  3923.  
  3924. # We need to display help for each of the modes.
  3925. case "$mode" in
  3926. "") $echo \
  3927. "Usage: $modename [OPTION]... [MODE-ARG]...
  3928.  
  3929. Provide generalized library-building support services.
  3930.  
  3931.     --config          show all configuration variables
  3932.     --debug           enable verbose shell tracing
  3933. -n, --dry-run         display commands without modifying any files
  3934.     --features        display basic configuration information and exit
  3935.     --finish          same as \`--mode=finish'
  3936.     --help            display this help message and exit
  3937.     --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
  3938.     --quiet           same as \`--silent'
  3939.     --silent          don't print informational messages
  3940.     --version         print version information
  3941.  
  3942. MODE must be one of the following:
  3943.  
  3944.       compile         compile a source file into a libtool object
  3945.       execute         automatically set library path, then run a program
  3946.       finish          complete the installation of libtool libraries
  3947.       install         install libraries or executables
  3948.       link            create a library or an executable
  3949.       uninstall       remove libraries from an installed directory
  3950.  
  3951. MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
  3952. a more detailed description of MODE."
  3953.   exit 0
  3954.   ;;
  3955.  
  3956. compile)
  3957.   $echo \
  3958. "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
  3959.  
  3960. Compile a source file into a libtool library object.
  3961.  
  3962. This mode accepts the following additional options:
  3963.  
  3964.   -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
  3965.   -static           always build a \`.o' file suitable for static linking
  3966.  
  3967. COMPILE-COMMAND is a command to be used in creating a \`standard' object file
  3968. from the given SOURCEFILE.
  3969.  
  3970. The output file name is determined by removing the directory component from
  3971. SOURCEFILE, then substituting the C source code suffix \`.c' with the
  3972. library object suffix, \`.lo'."
  3973.   ;;
  3974.  
  3975. execute)
  3976.   $echo \
  3977. "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
  3978.  
  3979. Automatically set library path, then run a program.
  3980.  
  3981. This mode accepts the following additional options:
  3982.  
  3983.   -dlopen FILE      add the directory containing FILE to the library path
  3984.  
  3985. This mode sets the library path environment variable according to \`-dlopen'
  3986. flags.
  3987.  
  3988. If any of the ARGS are libtool executable wrappers, then they are translated
  3989. into their corresponding uninstalled binary, and any of their required library
  3990. directories are added to the library path.
  3991.  
  3992. Then, COMMAND is executed, with ARGS as arguments."
  3993.   ;;
  3994.  
  3995. finish)
  3996.   $echo \
  3997. "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
  3998.  
  3999. Complete the installation of libtool libraries.
  4000.  
  4001. Each LIBDIR is a directory that contains libtool libraries.
  4002.  
  4003. The commands that this mode executes may require superuser privileges.  Use
  4004. the \`--dry-run' option if you just want to see what would be executed."
  4005.   ;;
  4006.  
  4007. install)
  4008.   $echo \
  4009. "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
  4010.  
  4011. Install executables or libraries.
  4012.  
  4013. INSTALL-COMMAND is the installation command.  The first component should be
  4014. either the \`install' or \`cp' program.
  4015.  
  4016. The rest of the components are interpreted as arguments to that command (only
  4017. BSD-compatible install options are recognized)."
  4018.   ;;
  4019.  
  4020. link)
  4021.   $echo \
  4022. "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
  4023.  
  4024. Link object files or libraries together to form another library, or to
  4025. create an executable program.
  4026.  
  4027. LINK-COMMAND is a command using the C compiler that you would use to create
  4028. a program from several object files.
  4029.  
  4030. The following components of LINK-COMMAND are treated specially:
  4031.  
  4032.   -all-static       do not do any dynamic linking at all
  4033.   -avoid-version    do not add a version suffix if possible
  4034.   -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
  4035.   -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
  4036.   -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
  4037.   -export-symbols SYMFILE
  4038.             try to export only the symbols listed in SYMFILE
  4039.   -export-symbols-regex REGEX
  4040.             try to export only the symbols matching REGEX
  4041.   -LLIBDIR          search LIBDIR for required installed libraries
  4042.   -lNAME            OUTPUT-FILE requires the installed library libNAME
  4043.   -module           build a library that can dlopened
  4044.   -no-undefined     declare that a library does not refer to external symbols
  4045.   -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
  4046.   -release RELEASE  specify package release information
  4047.   -rpath LIBDIR     the created library will eventually be installed in LIBDIR
  4048.   -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
  4049.   -static           do not do any dynamic linking of libtool libraries
  4050.   -version-info CURRENT[:REVISION[:AGE]]
  4051.             specify library version info [each variable defaults to 0]
  4052.  
  4053. All other options (arguments beginning with \`-') are ignored.
  4054.  
  4055. Every other argument is treated as a filename.  Files ending in \`.la' are
  4056. treated as uninstalled libtool libraries, other files are standard or library
  4057. object files.
  4058.  
  4059. If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
  4060. only library objects (\`.lo' files) may be specified, and \`-rpath' is
  4061. required, except when creating a convenience library.
  4062.  
  4063. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
  4064. using \`ar' and \`ranlib', or on Windows using \`lib'.
  4065.  
  4066. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
  4067. is created, otherwise an executable program is created."
  4068.   ;;
  4069.  
  4070. uninstall)
  4071.   $echo \
  4072. "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
  4073.  
  4074. Remove libraries from an installation directory.
  4075.  
  4076. RM is the name of the program to use to delete files associated with each FILE
  4077. (typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
  4078. to RM.
  4079.  
  4080. If FILE is a libtool library, all the files associated with it are deleted.
  4081. Otherwise, only FILE itself is deleted using RM."
  4082.   ;;
  4083.  
  4084. *)
  4085.   $echo "$modename: invalid operation mode \`$mode'" 1>&2
  4086.   $echo "$help" 1>&2
  4087.   exit 1
  4088.   ;;
  4089. esac
  4090.  
  4091. echo
  4092. $echo "Try \`$modename --help' for more information about other modes."
  4093.  
  4094. exit 0
  4095.  
  4096. # Local Variables:
  4097. # mode:shell-script
  4098. # sh-indentation:2
  4099. # End:
  4100.